@punks/cli 2.5.1 → 2.5.3
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/AGENTS.md +2 -2
- package/README.md +5 -5
- package/dist/BASELINE_CHANGELOG.md +39 -0
- package/dist/CHANGELOG.md +63 -0
- package/dist/data/hooks/format-edited-file.mjs +20 -0
- package/dist/index.js +255 -37
- package/dist/skills/agnostic/backend/backend-domain-structure/SKILL.md +18 -6
- package/dist/skills/agnostic/backend/backend-domain-structure/references/layout.md +61 -3
- package/dist/skills/agnostic/cli/{dp-cli → hi-cli}/SKILL.md +3 -3
- package/dist/skills/agnostic/cli/{dp-cli → hi-cli}/references/commands.md +1 -1
- package/dist/skills/agnostic/docs/docs-onboarding/SKILL.md +2 -2
- package/dist/skills/frameworks/pulumi/package-usage/SKILL.md +49 -0
- package/dist/skills/frameworks/pulumi/package-usage/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/pulumi/package-usage/use_cases.yaml +15 -0
- package/dist/skills/frameworks/pulumi/provider-upgrade/SKILL.md +332 -0
- package/dist/skills/frameworks/pulumi/provider-upgrade/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/pulumi/provider-upgrade/references/diagnostic-toolbox.md +131 -0
- package/dist/skills/frameworks/pulumi/provider-upgrade/use_cases.yaml +28 -0
- package/dist/skills/frameworks/pulumi/pulumi-automation-api/SKILL.md +320 -0
- package/dist/skills/frameworks/pulumi/pulumi-automation-api/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/pulumi/pulumi-automation-api/use_cases.yaml +7 -0
- package/dist/skills/frameworks/pulumi/pulumi-best-practices/SKILL.md +501 -0
- package/dist/skills/frameworks/pulumi/pulumi-best-practices/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/pulumi/pulumi-best-practices/use_cases.yaml +7 -0
- package/dist/skills/frameworks/pulumi/pulumi-component/SKILL.md +830 -0
- package/dist/skills/frameworks/pulumi/pulumi-component/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/pulumi/pulumi-component/use_cases.yaml +19 -0
- package/dist/skills/frameworks/pulumi/pulumi-esc/SKILL.md +281 -0
- package/dist/skills/frameworks/pulumi/pulumi-esc/agents/openai.yaml +4 -0
- package/dist/skills/frameworks/pulumi/pulumi-esc/use_cases.yaml +30 -0
- package/dist/skills/frameworks/pulumi/pulumi-overview/SKILL.md +289 -0
- package/dist/skills/frameworks/pulumi/pulumi-overview/use_cases.yaml +50 -0
- package/dist/skills/misc/timesheet/SKILL.md +87 -0
- package/dist/skills/misc/timesheet/scripts/git-timesheet-evidence.mjs +214 -0
- package/dist/skills/phases/goalify/SKILL.md +18 -54
- package/package.json +1 -1
- /package/dist/skills/agnostic/cli/{dp-cli → hi-cli}/references/post-command-flow.md +0 -0
|
@@ -15,6 +15,17 @@ Prefer this shape inside the backend root:
|
|
|
15
15
|
|
|
16
16
|
The backend root may be an app folder, package folder, service folder, or workspace package. Derive it from the current repo.
|
|
17
17
|
|
|
18
|
+
## Layer Classifier
|
|
19
|
+
|
|
20
|
+
Classify by responsibility before naming files or moving code.
|
|
21
|
+
|
|
22
|
+
- Transport/app composition: app creation, route registration, server start, middleware assembly, request context, top-level dependency wiring, and composition modules.
|
|
23
|
+
- Feature/product domains: use cases, policy, ports/contracts, protocols/interfaces, repositories, feature transport adapters, and public entrypoints for one product domain.
|
|
24
|
+
- Platform/framework concerns: framework modules, runtime context, request lifecycle, common middleware, config loading, and process adapters.
|
|
25
|
+
- Infrastructure/integrations: external SDKs, provider adapters, queues, email, storage, billing, search, analytics, and third-party API mechanics.
|
|
26
|
+
- Database persistence: queries, persistence model mapping, migrations, transaction helpers, and database client adapters.
|
|
27
|
+
- Pure domain models/events: identifiers, value objects, invariants, domain events, and data shapes without framework, transport, container, or persistence imports.
|
|
28
|
+
|
|
18
29
|
## Layer Meanings
|
|
19
30
|
|
|
20
31
|
### `platform/`
|
|
@@ -29,6 +40,7 @@ Good fits:
|
|
|
29
40
|
- router assembly
|
|
30
41
|
- dependency graph assembly
|
|
31
42
|
- process/runtime adapters
|
|
43
|
+
- framework modules and middleware shared by multiple features
|
|
32
44
|
|
|
33
45
|
Bad fits:
|
|
34
46
|
|
|
@@ -36,6 +48,7 @@ Bad fits:
|
|
|
36
48
|
- feature orchestration
|
|
37
49
|
- direct provider details that belong to an integration
|
|
38
50
|
- persistence queries that belong to repositories
|
|
51
|
+
- pure domain models or events
|
|
39
52
|
|
|
40
53
|
### `integrations/`
|
|
41
54
|
|
|
@@ -51,6 +64,8 @@ Good fits:
|
|
|
51
64
|
|
|
52
65
|
Do not put product policy in `integrations/`. An integration says how to talk to a system; a feature decides why and when.
|
|
53
66
|
|
|
67
|
+
Infrastructure implements feature ports/contracts or shared platform contracts. It should not import feature internals unless the project has an explicit adapter registration convention.
|
|
68
|
+
|
|
54
69
|
### `features/<domain>/`
|
|
55
70
|
|
|
56
71
|
Use features for business behavior.
|
|
@@ -68,6 +83,8 @@ Common local folders:
|
|
|
68
83
|
|
|
69
84
|
Feature domains own use cases, policy, persistence contracts, and public behavior.
|
|
70
85
|
|
|
86
|
+
Keep pure domain models, events, identifiers, and invariants free of transport, framework, container, and database imports.
|
|
87
|
+
|
|
71
88
|
## Actions vs Services
|
|
72
89
|
|
|
73
90
|
Default to actions.
|
|
@@ -94,6 +111,8 @@ Use `repositories/` for:
|
|
|
94
111
|
- query composition
|
|
95
112
|
- persistence model mapping
|
|
96
113
|
|
|
114
|
+
Database code stays behind repositories or persistence adapters. Actions and services should depend on repository contracts, not raw database clients or query builders, unless the existing stack has a narrow equivalent boundary.
|
|
115
|
+
|
|
97
116
|
Quick rule:
|
|
98
117
|
|
|
99
118
|
- "what this flow means" -> `actions/`
|
|
@@ -118,19 +137,46 @@ Business logic, external side effects, and DB queries should not live directly i
|
|
|
118
137
|
|
|
119
138
|
Prefer this direction:
|
|
120
139
|
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
140
|
+
- transport/app composition -> features
|
|
141
|
+
- platform composition -> features
|
|
142
|
+
- features -> platform contracts
|
|
143
|
+
- features -> integrations or infrastructure through ports/contracts
|
|
144
|
+
- features -> shared domain libraries
|
|
145
|
+
- integrations/infrastructure -> external systems
|
|
146
|
+
- integrations/infrastructure -> shared libraries
|
|
124
147
|
|
|
125
148
|
Avoid:
|
|
126
149
|
|
|
127
150
|
- `integrations -> features`
|
|
151
|
+
- lower layers importing route files, app creation, server start, or root composition
|
|
128
152
|
- shared libraries importing app-local code
|
|
129
153
|
- transport files importing many low-level helpers instead of one feature entrypoint
|
|
130
154
|
- feature domains reaching into another feature's internals
|
|
155
|
+
- database code leaking above repositories or persistence adapters
|
|
156
|
+
- lazy imports used to hide dependency cycles
|
|
131
157
|
|
|
132
158
|
Features may depend on other features only when the domain relationship is explicit, stable, and exposed through a public feature entrypoint.
|
|
133
159
|
|
|
160
|
+
## Dependency Injection
|
|
161
|
+
|
|
162
|
+
Composition roots own container wiring.
|
|
163
|
+
|
|
164
|
+
- Build containers, layers, modules, or dependency graphs in root composition or feature composition files.
|
|
165
|
+
- Pass protocols, interfaces, contracts, or concrete adapters into business logic.
|
|
166
|
+
- Keep domain models, events, actions, policies, and repository contracts free of container lookups.
|
|
167
|
+
- Treat lazy imports as a smell when they avoid a cycle instead of fixing import direction.
|
|
168
|
+
- Keep test wiring in test support or feature composition helpers, not inside production domain logic.
|
|
169
|
+
|
|
170
|
+
## Public Boundaries
|
|
171
|
+
|
|
172
|
+
Feature modules or package roots should expose deliberate public API.
|
|
173
|
+
|
|
174
|
+
- Export services, actions, ports/contracts, protocols/interfaces, adapters, events, errors, and named types meant for other layers.
|
|
175
|
+
- Keep internal helpers, provider details, persistence models, and transport plumbing private.
|
|
176
|
+
- Prefer stable named types at cross-layer boundaries over inline anonymous shapes.
|
|
177
|
+
- Remove compatibility aliases after clean refactors; do not leave stale names as a second API.
|
|
178
|
+
- Cross-feature calls should use public feature entrypoints, not internal files.
|
|
179
|
+
|
|
134
180
|
## Testing Layout
|
|
135
181
|
|
|
136
182
|
Keep tests near the owning feature or module.
|
|
@@ -165,3 +211,15 @@ Avoid a distant package-root `tests/` folder unless the project already has a st
|
|
|
165
211
|
- Are services reusable mechanics rather than use-case buckets?
|
|
166
212
|
- Are tests colocated with the owning domain?
|
|
167
213
|
- Are imports flowing one way without layer inversions?
|
|
214
|
+
- Does the composition root own container wiring?
|
|
215
|
+
- Are domain models/events free of framework, transport, container, and persistence imports?
|
|
216
|
+
- Do public feature modules or package roots expose only deliberate services/contracts and stable named types?
|
|
217
|
+
- Were compatibility aliases and stale symbols removed after moves?
|
|
218
|
+
|
|
219
|
+
## Validation Prompts
|
|
220
|
+
|
|
221
|
+
- Run architecture/import-boundary tests if the repo has them.
|
|
222
|
+
- Run focused compile, type, or test checks for the touched backend root.
|
|
223
|
+
- Grep for stale symbols, old paths, and compatibility aliases after moves.
|
|
224
|
+
- Inspect module import direction from route/app composition down through features and infrastructure.
|
|
225
|
+
- Check import cycles; do not silence them with local or lazy imports.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: hi-cli
|
|
3
3
|
description: Operates the Harness Intelligence CLI (`hi`, alias `hint`) and interactively follows scaffold, update, report, upgrade, and post-command handoff artifacts through to completion. Use when a repo contains `.devpunks/` output, when the user mentions `hi scaffold`, `hi update`, `hi report`, `hi upgrade`, `hint`, or asks what to do after running a Harness CLI command.
|
|
4
4
|
metadata: {"Harness Intelligence":{"entrypoint":true}}
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# hi-cli
|
|
8
8
|
|
|
9
|
-
The `
|
|
9
|
+
The `hi-cli` skill operates the Harness Intelligence CLI. The command is `hi`; `hint` is an alias. The npm package remains `@punks/cli`.
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: docs-onboarding
|
|
3
|
-
description: Onboard an existing project into a scaffolded Harness wiki by inspecting code, docs, and backlog context, building a Project Map, running a targeted requirements grill, and calling create-spec to reconstruct evidence-backed specs. Use immediately after
|
|
3
|
+
description: Onboard an existing project into a scaffolded Harness wiki by inspecting code, docs, and backlog context, building a Project Map, running a targeted requirements grill, and calling create-spec to reconstruct evidence-backed specs. Use immediately after hi scaffold init when the generated prompt says to activate docs-onboarding, or when an existing repository needs initial wiki/spec context reconstructed from current sources.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Docs Onboarding
|
|
7
7
|
|
|
8
|
-
Use this skill to turn an existing repository into initial Harness wiki context after `
|
|
8
|
+
Use this skill to turn an existing repository into initial Harness wiki context after `hi scaffold init`.
|
|
9
9
|
|
|
10
10
|
## Workflow
|
|
11
11
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: package-usage
|
|
3
|
+
description: Track which stacks across a Pulumi organization use a specific package and at what versions. Use for cross-stack audits, identifying outdated or unmaintained package versions across many stacks, finding affected stacks before publishing breaking changes to a component package, or planning coordinated upgrade rollouts. Do NOT use for upgrading a cloud provider package (pulumi-aws, pulumi-azure-native, pulumi-gcp, pulumi-kubernetes, etc.) in a single project — use skill `provider-upgrade` instead. Do NOT use for general infrastructure creation, resource provisioning, or how-to questions about a package.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## API Reference
|
|
7
|
+
|
|
8
|
+
### Get the latest version of a package
|
|
9
|
+
|
|
10
|
+
`GET /api/registry/packages?name={package_name}&orgLogin={orgName}`
|
|
11
|
+
|
|
12
|
+
You must include the `orgLogin` parameter with the user's organization name. The response contains a `packages` array. Each entry has a `version` field (the latest version), plus `name`, `publisher`, `source`, and `packageStatus`.
|
|
13
|
+
|
|
14
|
+
### Get stack usage for a package
|
|
15
|
+
|
|
16
|
+
`GET /api/orgs/{orgName}/packages/usage?packageName={package_name}`
|
|
17
|
+
|
|
18
|
+
Replace `{orgName}` with the org name from context, `PULUMI_ORG`, or ask the user.
|
|
19
|
+
|
|
20
|
+
Response fields:
|
|
21
|
+
- `packageName`: The queried package
|
|
22
|
+
- `stacks`: Array of `{stackName, projectName, version, lastUpdate}`
|
|
23
|
+
- `totalStacks`: Total count
|
|
24
|
+
|
|
25
|
+
## Workflow: Find outdated stacks
|
|
26
|
+
|
|
27
|
+
Use when the user wants to know which stacks are using an outdated version of a package.
|
|
28
|
+
|
|
29
|
+
1. Get the latest version of the package
|
|
30
|
+
2. Get stack usage for the package
|
|
31
|
+
3. Compare each stack's `version` against the latest to identify outdated stacks
|
|
32
|
+
4. Present results using the output format below
|
|
33
|
+
|
|
34
|
+
## Output Format
|
|
35
|
+
|
|
36
|
+
Present results as a markdown table followed by a summary line:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
| Project | Stack | Current Version | Latest Version | Status |
|
|
40
|
+
|---------|-------|-----------------|----------------|--------|
|
|
41
|
+
| my-app | dev | 6.40.0 | 6.52.0 | Outdated |
|
|
42
|
+
| my-app | prod | 6.52.0 | 6.52.0 | Up-to-date |
|
|
43
|
+
|
|
44
|
+
2 of 2 stacks checked. 1 outdated.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Out of scope: upgrading a specific stack
|
|
48
|
+
|
|
49
|
+
This skill identifies outdated stacks. It does not perform the upgrade itself. For actually bumping a package version in a project — editing `package.json`, `requirements.txt`, `pyproject.toml`, `go.mod`, or `Pulumi.yaml`, running `pulumi preview`, and reconciling the diff — hand off to the `provider-upgrade` skill.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Queries that should activate the package-usage skill
|
|
2
|
+
queries:
|
|
3
|
+
# Package usage tracking
|
|
4
|
+
- "Which stacks are using our networking package?"
|
|
5
|
+
- "What version of the database component is deployed across our stacks?"
|
|
6
|
+
- "Find all stacks using an outdated version of our shared infrastructure package"
|
|
7
|
+
- "How many stacks are using the @pulumi/aws-apigateway package?"
|
|
8
|
+
- "List stacks that need to upgrade their component versions"
|
|
9
|
+
- "Which teams are still using v1.x of our VPC component?"
|
|
10
|
+
- "Show me the package usage for our internal EKS component"
|
|
11
|
+
- "I want to deprecate a component package, which stacks would be affected?"
|
|
12
|
+
- "Are there any stacks using version 2.3.0 of our monitoring package?"
|
|
13
|
+
- "Query the usage of pulumi-aws-vpc across the organization"
|
|
14
|
+
- "Before I make breaking changes, tell me which stacks import this package"
|
|
15
|
+
- "Audit our component package adoption across all projects"
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: provider-upgrade
|
|
3
|
+
description: >
|
|
4
|
+
Upgrade any Pulumi provider to a newer version and reconcile the resulting diff. Use when
|
|
5
|
+
users want to upgrade or update a provider (including editing package.json, requirements.txt,
|
|
6
|
+
pyproject.toml, go.mod, or Pulumi.yaml to bump a provider SDK), check for breaking changes
|
|
7
|
+
before or during an upgrade, fix resources that broke after a provider upgrade, or resolve
|
|
8
|
+
unexpected replacements, creates, or deletes in a post-upgrade preview. Applies to all
|
|
9
|
+
providers (aws, azure-native, gcp, kubernetes, aws-native, cloudflare, datadog, etc.) — not
|
|
10
|
+
just Tier 1. Do NOT use for querying which stacks use what package versions; use skill
|
|
11
|
+
`package-usage` for cross-stack audits. Do NOT use for general infrastructure tasks.
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Upgrading Pulumi Providers
|
|
15
|
+
|
|
16
|
+
## The Principle
|
|
17
|
+
|
|
18
|
+
A provider upgrade is a translation, not a change request.
|
|
19
|
+
|
|
20
|
+
The user's infrastructure intent hasn't changed - they still want the same bucket, the
|
|
21
|
+
same function, the same cluster. What changed is how the provider's API expresses that
|
|
22
|
+
intent. Your job is to translate their existing code into the new API so that Pulumi sees
|
|
23
|
+
no difference between what the code says and what already exists.
|
|
24
|
+
|
|
25
|
+
There are four layers to keep in mind:
|
|
26
|
+
|
|
27
|
+
1. **User intent** - what the user wants in the cloud (unchanged during an upgrade)
|
|
28
|
+
2. **Code** - how the program expresses that intent using the provider API (may need updating)
|
|
29
|
+
3. **Pulumi state** - Pulumi's stored representation of what exists (may need reconciliation)
|
|
30
|
+
4. **Real cloud** - the actual infrastructure (should not change during an upgrade)
|
|
31
|
+
|
|
32
|
+
During an upgrade, layers 2 and 3 may need to change so that they continue to correctly
|
|
33
|
+
represent the unchanged layers 1 and 4.
|
|
34
|
+
|
|
35
|
+
A correct translation produces zero diff. The Pulumi engine doesn't have a concept of
|
|
36
|
+
"upgrade" - it just compares goal state (your code) against actual state (the state file)
|
|
37
|
+
and reconciles. If the translation is correct, those two states match and nothing happens.
|
|
38
|
+
If you see a diff, either your translation is wrong, or something beyond a code change is
|
|
39
|
+
needed (import, alias, manual step). In all cases, the diff is a problem to solve, not a
|
|
40
|
+
consequence to accept.
|
|
41
|
+
|
|
42
|
+
## The Core Loop
|
|
43
|
+
|
|
44
|
+
```mermaid
|
|
45
|
+
flowchart TD
|
|
46
|
+
A[Bump version] --> B[Run preview with env vars]
|
|
47
|
+
B --> C{Clean?}
|
|
48
|
+
C -->|Yes| D[Create PR]
|
|
49
|
+
C -->|No| E[Diff Checkpoint: categorize every diff]
|
|
50
|
+
E --> F{Any Category A?}
|
|
51
|
+
F -->|Yes| G[Fix wrong translations]
|
|
52
|
+
G --> B
|
|
53
|
+
F -->|No| H{Any Category B?}
|
|
54
|
+
H -->|Yes| I[Investigate with toolbox]
|
|
55
|
+
I --> J[Fix or document]
|
|
56
|
+
J --> B
|
|
57
|
+
H -->|No| D
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
1. **Bump** the provider dependency
|
|
61
|
+
2. **Preview** with required CLI flags
|
|
62
|
+
3. **Diff Checkpoint** - categorize every non-`same` resource (see next section)
|
|
63
|
+
4. **Fix Category A** - code changes that didn't produce `same`
|
|
64
|
+
5. **Investigate Category B** - diffs on resources you didn't change
|
|
65
|
+
6. **Repeat** until clean or remaining diffs are fully investigated
|
|
66
|
+
7. **Create PR** with upgrade summary
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## The Diff Checkpoint
|
|
71
|
+
|
|
72
|
+
This is the most important section. Run this after EVERY preview.
|
|
73
|
+
|
|
74
|
+
For each non-`same` resource, answer one question:
|
|
75
|
+
**"Did any of my code changes affect this resource - directly or indirectly?"**
|
|
76
|
+
|
|
77
|
+
"Directly" means you edited the resource block itself. "Indirectly" means you changed
|
|
78
|
+
something that feeds into this resource - a shared variable, an output from another
|
|
79
|
+
resource, a helper function, a default value, or a resource that this one depends on.
|
|
80
|
+
If your changes could have altered what Pulumi computes for this resource, it's Category A.
|
|
81
|
+
|
|
82
|
+
Then follow the category that applies.
|
|
83
|
+
|
|
84
|
+
### Category A: I changed code for this resource
|
|
85
|
+
|
|
86
|
+
Your code change was supposed to translate the same intent into the new API. If the
|
|
87
|
+
resource shows `same`, your translation is correct. If it shows anything else, your
|
|
88
|
+
translation is wrong. Not "the diff is expected because I changed the code" - if the
|
|
89
|
+
change were semantically equivalent, there would be no diff.
|
|
90
|
+
|
|
91
|
+
**I modified an existing resource and it shows `update`:**
|
|
92
|
+
|
|
93
|
+
Your rename, restructure, or value adjustment changed the meaning, not just the syntax.
|
|
94
|
+
The resource would show `same` if the old and new code compiled to the same goal state.
|
|
95
|
+
The `update` means they don't.
|
|
96
|
+
|
|
97
|
+
Ask yourself: *"If this rename were truly equivalent, the resource would show `same`.
|
|
98
|
+
It doesn't. What is semantically different between my old code and my new code?"*
|
|
99
|
+
|
|
100
|
+
Common causes: the new property name maps to a different underlying field; the value
|
|
101
|
+
shape changed and your conversion lost or added information; a default value changed
|
|
102
|
+
in the new version and you need to explicitly set the old value; additional properties
|
|
103
|
+
now appear in the diff because the new provider version tracks fields it didn't before
|
|
104
|
+
(these need to be set explicitly to match the current state).
|
|
105
|
+
|
|
106
|
+
If the update includes properties you didn't change - new fields appearing, type
|
|
107
|
+
normalizations (string->number), additional defaults - that's the provider changing what
|
|
108
|
+
it tracks. But if the diff is there, `pulumi up` WILL send those values to the cloud API.
|
|
109
|
+
Don't assume they're no-ops. Investigate each changed property.
|
|
110
|
+
|
|
111
|
+
**I added a new resource block and it shows `create`:**
|
|
112
|
+
|
|
113
|
+
During an upgrade, a new resource block almost always represents infrastructure that
|
|
114
|
+
already exists in the cloud. The old provider managed it implicitly (as part of another
|
|
115
|
+
resource); the new provider needs an explicit resource. But the cloud object is already
|
|
116
|
+
there. Pulumi wants to create NEW infrastructure - that's not what you want.
|
|
117
|
+
|
|
118
|
+
The fix is `import`, not `create`. Tell Pulumi to adopt the existing cloud resource.
|
|
119
|
+
|
|
120
|
+
Ask yourself: *"What cloud object does this new resource represent? Does it already
|
|
121
|
+
exist? How was it managed before the upgrade?"*
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// Wrong - creates duplicate infrastructure
|
|
125
|
+
const stage = new aws.apigateway.Stage("prodStage", { ... });
|
|
126
|
+
|
|
127
|
+
// Right - adopts the existing resource
|
|
128
|
+
const stage = new aws.apigateway.Stage("prodStage", { ... }, {
|
|
129
|
+
import: "<rest-api-id>/prod", // import ID format varies by resource type
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**I removed a resource block and it shows `delete`:**
|
|
134
|
+
|
|
135
|
+
A `delete` in the preview means `pulumi up` will call the provider's Delete API to
|
|
136
|
+
destroy or unconfigure this cloud resource. This is real destruction - not just state
|
|
137
|
+
cleanup. The cloud infrastructure still exists and is almost certainly still needed.
|
|
138
|
+
|
|
139
|
+
This is different from `pulumi state delete`, which removes the resource from Pulumi's
|
|
140
|
+
tracking WITHOUT calling the provider's API. When a resource type is removed in a new
|
|
141
|
+
provider version, the correct approach is:
|
|
142
|
+
1. `pulumi state delete '<urn>'` - manual step, removes from tracking only
|
|
143
|
+
2. Add replacement resources (if any) with imports - adopts the cloud state under new types
|
|
144
|
+
3. Verify with preview
|
|
145
|
+
|
|
146
|
+
Do NOT leave a `delete` in the preview and proceed to PR creation. A delete that runs
|
|
147
|
+
via `pulumi up` will destroy real infrastructure. If the resource must be removed from
|
|
148
|
+
state, document it as a manual step for the user.
|
|
149
|
+
|
|
150
|
+
Ask yourself: *"What cloud infrastructure does this resource manage? If `pulumi up` runs
|
|
151
|
+
this delete, what gets destroyed or unconfigured?"*
|
|
152
|
+
|
|
153
|
+
### Category B: I didn't change code for this resource
|
|
154
|
+
|
|
155
|
+
This diff was not caused by your code changes. It comes from the provider version change
|
|
156
|
+
itself - a different default, a changed state representation, or a behavioral difference.
|
|
157
|
+
Read `references/diagnostic-toolbox.md` and investigate.
|
|
158
|
+
|
|
159
|
+
These diffs might be:
|
|
160
|
+
- **Fixable with code** - set an explicit value for a changed default, add an alias
|
|
161
|
+
- **A documented no-op** - the upgrade guide says it resolves on `pulumi up` without
|
|
162
|
+
affecting real infrastructure. This classification REQUIRES a citation from the upgrade
|
|
163
|
+
guide or provider documentation. Your own judgment that "this looks like a no-op" is
|
|
164
|
+
not sufficient - the user is trusting you to distinguish real infrastructure changes
|
|
165
|
+
from artifacts, and getting it wrong means unexpected changes to their cloud.
|
|
166
|
+
- **Requiring manual steps** - state removal + reimport, documented for the user
|
|
167
|
+
- **Unknown** - present what you've found to the user and ask for guidance
|
|
168
|
+
|
|
169
|
+
### Category C: Provider version bump
|
|
170
|
+
|
|
171
|
+
An `update` on `pulumi:providers:{name}` showing only a version change is the one
|
|
172
|
+
expected diff. Verify no other properties changed on the provider resource.
|
|
173
|
+
|
|
174
|
+
### After categorizing
|
|
175
|
+
|
|
176
|
+
**Completeness check:** Every resource in the preview that shows any non-`same` state
|
|
177
|
+
must appear in your checkpoint - including resources with `[diff: ...]` annotations,
|
|
178
|
+
even if they don't have an explicit create/update/delete marker. If you didn't list it,
|
|
179
|
+
your checkpoint is incomplete. Go back and categorize the missing resources.
|
|
180
|
+
|
|
181
|
+
**Evidence requirement for accepted diffs:** If you want to accept any diff as "OK"
|
|
182
|
+
(not fix it), you need evidence - whether it's Category A or Category B. "I believe the
|
|
183
|
+
API treats these equivalently" or "this looks like state reconciliation" is not evidence.
|
|
184
|
+
Acceptable evidence: the upgrade guide documents it, a GitHub issue confirms it, or the
|
|
185
|
+
provider documentation explains the behavior. If you can't find evidence, either fix the
|
|
186
|
+
diff or flag it to the user.
|
|
187
|
+
|
|
188
|
+
**Ordering:** Fix all Category A issues before investigating Category B. Your code
|
|
189
|
+
corrections will change the preview output, so investigating Category B diffs first wastes
|
|
190
|
+
effort. Fix your own mistakes first, re-preview, then look at what remains.
|
|
191
|
+
|
|
192
|
+
**No `delete` or `replace` in the final preview.** If a delete or replace remains when
|
|
193
|
+
you're ready to create a PR, stop. A delete means `pulumi up` will destroy cloud
|
|
194
|
+
infrastructure. A replace means it will destroy and recreate. These are never acceptable
|
|
195
|
+
as "remaining diffs" - they must be resolved (via code fix, alias, or documented manual
|
|
196
|
+
steps) before proceeding.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Hard Rules
|
|
201
|
+
|
|
202
|
+
### Required CLI flags
|
|
203
|
+
|
|
204
|
+
Use these flags when running preview. A preview without them can show false diffs
|
|
205
|
+
(phantom tag removals, region additions) that aren't real. Don't interpret a preview
|
|
206
|
+
that was run without them.
|
|
207
|
+
|
|
208
|
+
```shell
|
|
209
|
+
pulumi preview --refresh --run-program
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
- `--refresh` refreshes actual cloud state before diffing.
|
|
213
|
+
- `--run-program` runs the Pulumi program during refresh.
|
|
214
|
+
|
|
215
|
+
### Don't chase deprecations
|
|
216
|
+
|
|
217
|
+
If something is deprecated but still works, leave it alone. Migrating to the replacement
|
|
218
|
+
introduces risk for no benefit. A deprecation warning is acceptable - a diff is not.
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
// BAD: migrating deprecated-but-working properties introduces risk
|
|
222
|
+
new aws.s3.Bucket('bucket');
|
|
223
|
+
new aws.s3.BucketLogging('bucketLogging', {...}); // unnecessary migration
|
|
224
|
+
|
|
225
|
+
// GOOD: fix only the actual error, leave working code alone
|
|
226
|
+
new aws.s3.Bucket('bucket', {
|
|
227
|
+
logging: {...}, // "loggings" renamed to "logging" - real breaking change
|
|
228
|
+
website: {...}, // deprecated but works - don't touch
|
|
229
|
+
});
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Be minimally invasive
|
|
233
|
+
|
|
234
|
+
Every line changed could introduce a regression. Prefer the smallest change that works.
|
|
235
|
+
|
|
236
|
+
### Do not run pulumi up
|
|
237
|
+
|
|
238
|
+
Provider upgrades modify source code and need code review before deployment.
|
|
239
|
+
PR -> review -> merge -> deploy via CI/CD.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Getting Started
|
|
244
|
+
|
|
245
|
+
### 1. Get version information
|
|
246
|
+
|
|
247
|
+
Determine the target version from the user's request, the Pulumi Registry, package
|
|
248
|
+
manager metadata, or the repository's existing dependency constraints.
|
|
249
|
+
|
|
250
|
+
Default to the latest stable version if the user hasn't specified a target version.
|
|
251
|
+
If the user asks which stacks or projects are affected, use skill `package-usage` or
|
|
252
|
+
the best available package inventory tooling before making changes.
|
|
253
|
+
|
|
254
|
+
### 2. Update the dependency
|
|
255
|
+
|
|
256
|
+
- **TypeScript/JavaScript**: `npm install @pulumi/{provider}@^{version}` or `yarn add @pulumi/{provider}@^{version}`
|
|
257
|
+
- **Python**: Update `pyproject.toml` or `requirements.txt` with `pulumi_{provider}>={version}` (underscore, not hyphen), then install
|
|
258
|
+
- **Go**: `go get github.com/pulumi/pulumi-{provider}/sdk/v{major}@latest`, update all import paths (e.g., `v6` -> `v7`), run `go mod tidy`
|
|
259
|
+
- **.NET**: `dotnet add package Pulumi.{Provider} --version {version}`
|
|
260
|
+
- **Java**: Update `pom.xml` or `build.gradle` dependency version
|
|
261
|
+
- **YAML**: Update provider version in resource options or provider configuration. See https://www.pulumi.com/docs/iac/languages-sdks/yaml/yaml-language-reference/#providers-and-provider-versions for examples.
|
|
262
|
+
|
|
263
|
+
After installing, check the actual installed version from the lockfile (package-lock.json,
|
|
264
|
+
go.sum, etc.) - use these exact versions for schema-tools comparisons.
|
|
265
|
+
|
|
266
|
+
### 3. Run preview
|
|
267
|
+
|
|
268
|
+
Run `pulumi preview --refresh --run-program` immediately after updating the dependency.
|
|
269
|
+
Do not research breaking changes first - many upgrades just work, especially minor
|
|
270
|
+
versions.
|
|
271
|
+
|
|
272
|
+
If the preview is clean (only the provider version bump), create a PR.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Preview Progress
|
|
277
|
+
|
|
278
|
+
Preview can fail on the first error and hide others. Fixing one error often reveals new
|
|
279
|
+
errors. This is normal progress, not a sign that fixes are making things worse.
|
|
280
|
+
|
|
281
|
+
- **New or different errors** -> progress, continue
|
|
282
|
+
- **Error set shrank** -> progress, continue
|
|
283
|
+
- **Same error persists** -> your fix didn't work, try a different approach
|
|
284
|
+
- **No errors but diffs** -> run the diff checkpoint
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Upgrade Summary
|
|
289
|
+
|
|
290
|
+
Once the preview is clean (or as clean as possible), present the summary:
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
## Upgrade Summary: {provider} v{current} -> v{target}
|
|
294
|
+
|
|
295
|
+
### Code Changes
|
|
296
|
+
| File | Change | Why it preserves intent |
|
|
297
|
+
|------|--------|------------------------|
|
|
298
|
+
| package.json | Version bump | - |
|
|
299
|
+
| index.ts:15 | loggings -> logging | Property renamed, same underlying field |
|
|
300
|
+
|
|
301
|
+
### Preview Result
|
|
302
|
+
All resources show `same` except provider version bump.
|
|
303
|
+
{Or: N resources show diffs - see below}
|
|
304
|
+
|
|
305
|
+
### Remaining Diffs (if any)
|
|
306
|
+
| Resource | Operation | What happens on `pulumi up` | Risk | Source |
|
|
307
|
+
|----------|-----------|---------------------------|------|--------|
|
|
308
|
+
| aws:s3:Bucket (myBucket) | update (-tags) | No-op, state reconciles | None | AWS v7 guide section 3.2 |
|
|
309
|
+
|
|
310
|
+
Every remaining diff MUST cite an authoritative source (upgrade guide, provider docs,
|
|
311
|
+
upstream GitHub issue). "I believe this is expected" is not a source.
|
|
312
|
+
|
|
313
|
+
### Manual Steps Required (if any)
|
|
314
|
+
1. `pulumi state delete '<urn>'` - remove old type binding
|
|
315
|
+
2. `pulumi import <type> <name> <id>` - adopt under new type
|
|
316
|
+
3. `pulumi preview --refresh --run-program` - verify clean
|
|
317
|
+
|
|
318
|
+
### Deprecation Warnings (no action taken)
|
|
319
|
+
- List deprecated-but-working code left intentionally
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
If the preview is clean (or all remaining diffs are documented no-ops with cited sources),
|
|
323
|
+
create a pull request. If unresolved diffs remain, present the summary as an exception
|
|
324
|
+
report and ask the user how they'd like to proceed before creating a PR.
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## References
|
|
329
|
+
|
|
330
|
+
- `references/diagnostic-toolbox.md` - upgrade guides, schema-tools (install, run,
|
|
331
|
+
interpret output), stack state inspection, SDK types, GitHub issues. Read when
|
|
332
|
+
investigating Category B diffs.
|