pulumi-package-docs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/bin/cli.js +80 -0
- package/dist/client/assets/MemberDetail-CX9jiyic.js +1 -0
- package/dist/client/assets/index-CZRUHwIq.js +13 -0
- package/dist/client/assets/providers._name-DpU324kz.js +1 -0
- package/dist/client/assets/providers._name.functions._token-DXrP4mSE.js +1 -0
- package/dist/client/assets/providers._name.functions._token-bvc3vrG2.js +1 -0
- package/dist/client/assets/providers._name.index-CtKE1x7S.js +1 -0
- package/dist/client/assets/providers._name.index-tTXQzRr7.js +1 -0
- package/dist/client/assets/providers._name.resources._token--BZM8RBv.js +1 -0
- package/dist/client/assets/providers._name.resources._token-CbZkRkaE.js +1 -0
- package/dist/client/assets/routes-GAgiQcBX.js +1 -0
- package/dist/client/assets/styles-CWDprFhI.css +1 -0
- package/dist/client/assets/token-oQmZfAP3.js +1 -0
- package/dist/client/assets/useSelector-BIt42tGI.js +1 -0
- package/dist/server/assets/MemberDetail-BiBAI1vw.js +96 -0
- package/dist/server/assets/_tanstack-start-manifest_v-Cl1i6HDY.js +62 -0
- package/dist/server/assets/api-BV6lykkP.js +20 -0
- package/dist/server/assets/api-C55bS4R6.js +64 -0
- package/dist/server/assets/empty-plugin-adapters-D9UWiqvJ.js +5 -0
- package/dist/server/assets/providers._name-DF6sA3DG.js +6 -0
- package/dist/server/assets/providers._name.functions._token-C0A7Y90t.js +21 -0
- package/dist/server/assets/providers._name.functions._token-D8LsoIum.js +13 -0
- package/dist/server/assets/providers._name.index-BEwt-7U0.js +13 -0
- package/dist/server/assets/providers._name.index-BK_ZRd5l.js +97 -0
- package/dist/server/assets/providers._name.resources._token-CbvRkms4.js +22 -0
- package/dist/server/assets/providers._name.resources._token-DJPF8nMg.js +13 -0
- package/dist/server/assets/router-DZSocx9m.js +562 -0
- package/dist/server/assets/routes-B-G_iLTo.js +82 -0
- package/dist/server/assets/schema.server-B-VvU1qb.js +122 -0
- package/dist/server/assets/start-5Z2QO8AU.js +4 -0
- package/dist/server/server.js +2003 -0
- package/package.json +67 -0
- package/src/components/CodeExample.tsx +14 -0
- package/src/components/MemberDetail.tsx +89 -0
- package/src/components/PropertyTable.tsx +49 -0
- package/src/components/PulumiLogo.tsx +86 -0
- package/src/lib/pulumi/api.ts +77 -0
- package/src/lib/pulumi/description.test.ts +54 -0
- package/src/lib/pulumi/description.ts +35 -0
- package/src/lib/pulumi/discovery.server.test.ts +117 -0
- package/src/lib/pulumi/discovery.server.ts +77 -0
- package/src/lib/pulumi/examples.test.ts +97 -0
- package/src/lib/pulumi/examples.ts +55 -0
- package/src/lib/pulumi/format.test.ts +51 -0
- package/src/lib/pulumi/format.ts +11 -0
- package/src/lib/pulumi/mcp.server.ts +343 -0
- package/src/lib/pulumi/naming.test.ts +27 -0
- package/src/lib/pulumi/naming.ts +31 -0
- package/src/lib/pulumi/schema.server.ts +78 -0
- package/src/lib/pulumi/token.test.ts +21 -0
- package/src/lib/pulumi/token.ts +10 -0
- package/src/lib/pulumi/types.ts +62 -0
- package/src/routeTree.gen.ts +187 -0
- package/src/router.tsx +19 -0
- package/src/routes/__root.tsx +59 -0
- package/src/routes/index.tsx +78 -0
- package/src/routes/mcp.ts +30 -0
- package/src/routes/providers.$name.functions.$token.tsx +47 -0
- package/src/routes/providers.$name.index.tsx +129 -0
- package/src/routes/providers.$name.resources.$token.tsx +48 -0
- package/src/routes/providers.$name.tsx +5 -0
- package/src/styles.css +478 -0
- package/tsconfig.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Piers Karsenbarg
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# pulumi-package-docs
|
|
2
|
+
|
|
3
|
+
A local documentation viewer for the parameterized/local Pulumi providers used by a Pulumi project (e.g. providers added with `pulumi package add`). Run it from inside a Pulumi project and it lists the packages declared in `Pulumi.yaml`'s `packages` section, fetches each one's schema via the `pulumi` CLI, and renders its resources and functions.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx pulumi-package-docs
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This serves docs for the Pulumi project in your current directory. Options:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pulumi-package-docs [options]
|
|
15
|
+
|
|
16
|
+
-d, --dir <path> Pulumi project directory to inspect (default: current directory)
|
|
17
|
+
-p, --port <port> Port to serve on (default: 3000)
|
|
18
|
+
--host Expose the server on your network
|
|
19
|
+
-h, --help Show this help message
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Requires the `pulumi` CLI to be installed and on `PATH`; it's used to fetch each provider's schema (`pulumi package get-schema`). If a schema was fetched successfully before, it's cached and reused if a later CLI call fails.
|
|
23
|
+
|
|
24
|
+
## MCP
|
|
25
|
+
|
|
26
|
+
The server also exposes an [MCP](https://modelcontextprotocol.io) endpoint at `/mcp` (Streamable HTTP), so a coding agent can look up the same local provider docs without browsing the site. Point an MCP client at `http://localhost:3000/mcp` (e.g. in Claude Code, `claude mcp add --transport http pulumi-package-docs http://localhost:3000/mcp`). Tools:
|
|
27
|
+
|
|
28
|
+
- `list_providers` — the local providers declared in `Pulumi.yaml`, with resource/function counts and schema load status.
|
|
29
|
+
- `list_resources` / `list_functions` — a provider's resource or function tokens, with a one-line summary and deprecation status for each.
|
|
30
|
+
- `get_resource` / `get_function` — full docs for one resource or function: description, a usage example in the project's own language, and inputs/outputs (name, type, required, description).
|
|
31
|
+
- `search_members` — keyword search across one or all providers' resources and functions, for when a provider is too large to list in full.
|
|
32
|
+
|
|
33
|
+
## Development
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install
|
|
37
|
+
npm run dev
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This starts the TanStack Start dev server, and inspects the Pulumi project in this repo's own directory by default. Point it at another project's `Pulumi.yaml` with the `PULUMI_LOCAL_DOCS_DIR` env var:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
PULUMI_LOCAL_DOCS_DIR=/path/to/pulumi/project npm run dev
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Routes live under `src/routes`; TanStack Router regenerates `src/routeTree.gen.ts` automatically. Pulumi project discovery and schema fetching live in `src/lib/pulumi`.
|
|
47
|
+
|
|
48
|
+
Run the tests with:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm test
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Build the production app with:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm run build
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`bin/cli.js` is the `npx` entry point: it serves the production build with `vite preview` if one exists (`npm run build` first), otherwise falls back to `vite dev`.
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync } from 'node:fs'
|
|
3
|
+
import { createRequire } from 'node:module'
|
|
4
|
+
import { dirname, join, resolve } from 'node:path'
|
|
5
|
+
import { fileURLToPath } from 'node:url'
|
|
6
|
+
import { spawn } from 'node:child_process'
|
|
7
|
+
|
|
8
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
9
|
+
const require = createRequire(import.meta.url)
|
|
10
|
+
|
|
11
|
+
function parseArgs(argv) {
|
|
12
|
+
const options = { dir: process.cwd(), port: '3000', host: false }
|
|
13
|
+
for (let i = 0; i < argv.length; i++) {
|
|
14
|
+
const arg = argv[i]
|
|
15
|
+
if (arg === '--dir' || arg === '-d') {
|
|
16
|
+
options.dir = resolve(argv[++i])
|
|
17
|
+
} else if (arg === '--port' || arg === '-p') {
|
|
18
|
+
options.port = argv[++i]
|
|
19
|
+
} else if (arg === '--host') {
|
|
20
|
+
options.host = true
|
|
21
|
+
} else if (arg === '--help' || arg === '-h') {
|
|
22
|
+
options.help = true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return options
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function printHelp() {
|
|
29
|
+
console.log(`pulumi-package-docs [options]
|
|
30
|
+
|
|
31
|
+
Serves local documentation for the parameterized/local Pulumi providers used
|
|
32
|
+
by a Pulumi project.
|
|
33
|
+
|
|
34
|
+
Options:
|
|
35
|
+
-d, --dir <path> Pulumi project directory to inspect (default: current directory)
|
|
36
|
+
-p, --port <port> Port to serve on (default: 3000)
|
|
37
|
+
--host Expose the server on your network
|
|
38
|
+
-h, --help Show this help message
|
|
39
|
+
`)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const options = parseArgs(process.argv.slice(2))
|
|
43
|
+
|
|
44
|
+
if (options.help) {
|
|
45
|
+
printHelp()
|
|
46
|
+
process.exit(0)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const vitePkgJson = require.resolve('vite/package.json')
|
|
50
|
+
const viteBin = join(dirname(vitePkgJson), 'bin', 'vite.js')
|
|
51
|
+
|
|
52
|
+
const hasProductionBuild = existsSync(
|
|
53
|
+
join(packageRoot, 'dist', 'server', 'server.js'),
|
|
54
|
+
)
|
|
55
|
+
const viteArgs = [
|
|
56
|
+
hasProductionBuild ? 'preview' : 'dev',
|
|
57
|
+
'--port',
|
|
58
|
+
options.port,
|
|
59
|
+
]
|
|
60
|
+
if (options.host) viteArgs.push('--host')
|
|
61
|
+
|
|
62
|
+
if (!hasProductionBuild) {
|
|
63
|
+
console.log(
|
|
64
|
+
'No production build found, starting the dev server instead (this is slower).',
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
console.log(`Serving provider docs for: ${options.dir}`)
|
|
68
|
+
console.log(`MCP endpoint: http://localhost:${options.port}/mcp`)
|
|
69
|
+
|
|
70
|
+
const child = spawn(process.execPath, [viteBin, ...viteArgs], {
|
|
71
|
+
cwd: packageRoot,
|
|
72
|
+
stdio: 'inherit',
|
|
73
|
+
env: { ...process.env, PULUMI_LOCAL_DOCS_DIR: options.dir },
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
child.on('exit', (code) => process.exit(code ?? 0))
|
|
77
|
+
child.on('error', (err) => {
|
|
78
|
+
console.error('Failed to start pulumi-package-docs:', err)
|
|
79
|
+
process.exit(1)
|
|
80
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./useSelector-BIt42tGI.js";import{o as t}from"./index-CZRUHwIq.js";import{i as n,n as r,o as i,r as a}from"./token-oQmZfAP3.js";var o=e();function s({example:e}){return e?(0,o.jsxs)(`div`,{className:`code-example`,children:[(0,o.jsx)(`span`,{className:`code-example-lang`,children:e.language}),(0,o.jsx)(`pre`,{children:(0,o.jsx)(`code`,{children:e.code})})]}):(0,o.jsx)(`p`,{className:`empty-state`,children:`No examples in the schema.`})}function c(e){if(!e)return`any`;if(e.$ref){let t=e.$ref.split(`/`).pop()??e.$ref;return decodeURIComponent(t)}return e.type===`array`&&e.items?`${c(e.items)}[]`:e.type??`any`}function l(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1_$2`).toLowerCase()}function u(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function d(e,t){switch(t){case`python`:return l(e);case`go`:case`dotnet`:return u(e);default:return e}}function f({properties:e,required:t,runtime:n}){let r=Object.keys(e??{});if(r.length===0)return(0,o.jsx)(`p`,{className:`empty-state`,children:`None`});let a=new Set(t??[]);return(0,o.jsxs)(`table`,{className:`props-table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:`Name`}),(0,o.jsx)(`th`,{children:`Type`}),(0,o.jsx)(`th`,{children:`Required`}),(0,o.jsx)(`th`,{children:`Description`})]})}),(0,o.jsx)(`tbody`,{children:r.map(t=>{let r=e[t];return(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`code`,{children:d(t,n)})}),(0,o.jsx)(`td`,{children:(0,o.jsx)(`code`,{children:c(r)})}),(0,o.jsx)(`td`,{children:a.has(t)?`yes`:`no`}),(0,o.jsx)(`td`,{children:i(r.description,n)??``})]},t)})})]})}function p({providerName:e,kind:c,displayName:l,token:u,description:d,deprecationMessage:p,runtime:m,inputProperties:h,requiredInputs:g,outputProperties:_,requiredOutputs:v}){let y=i(d,m),b=n(y),x=a(r(y),m);return(0,o.jsxs)(`main`,{className:`provider-detail`,children:[(0,o.jsxs)(t,{to:`/providers/$name`,params:{name:e},className:`back-link`,children:[`← Back to `,e]}),(0,o.jsx)(`h1`,{children:l}),(0,o.jsxs)(`p`,{className:`subtitle`,children:[(0,o.jsx)(`span`,{className:`badge ${c===`Resource`?`badge-resource`:`badge-function`}`,children:c}),` `,`· `,(0,o.jsx)(`code`,{children:u})]}),p&&(0,o.jsxs)(`p`,{className:`banner banner-warning`,children:[`Deprecated: `,p]}),b?.split(/\n{2,}/).map((e,t)=>(0,o.jsx)(`p`,{children:e},t)),(0,o.jsx)(`h2`,{children:`Example`}),(0,o.jsx)(s,{example:x}),(0,o.jsx)(`h2`,{children:`Inputs`}),(0,o.jsx)(f,{properties:h,required:g,runtime:m}),(0,o.jsx)(`h2`,{children:`Outputs`}),(0,o.jsx)(f,{properties:_,required:v,runtime:m})]})}export{p as t};
|