Show independent/dependent package type in pkg tree output - #4668
Show independent/dependent package type in pkg tree output#4668aravindtga wants to merge 1 commit into
Conversation
Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
This PR updates kpt pkg tree output to annotate packages as (independent) or (dependent) based on whether their Kptfile contains an upstream section, making package update boundaries visible directly in the tree output.
Changes:
- Add Kptfile parsing to determine and display package type in
pkg treeoutput (root annotated only when independent). - Update/extend tests to validate independent/dependent annotations (including nested subpackages).
- Update CLI reference + book/guides to document the new annotations and show updated examples.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| thirdparty/cmdconfig/commands/cmdtree/tree.go | Adds package-type detection by reading/parsing Kptfiles and annotating tree output. |
| thirdparty/cmdconfig/commands/cmdtree/cmdtree_test.go | Updates existing expectations and adds new coverage for independent/dependent behavior. |
| documentation/content/en/reference/cli/pkg/tree/_index.md | Documents annotations and adds an example output snippet. |
| documentation/content/en/guides/namespace-provisioning-cli.md | Updates example output to include (independent). |
| documentation/content/en/book/03-packages/_index.md | Updates book examples to include (independent)/(dependent). |
| documentation/content/en/book/02-concepts/_index.md | Updates concept examples to include (independent)/(dependent). |
| documentation/content/en/book/01-getting-started/_index.md | Updates getting-started example to include (independent). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func packageType(dir string) string { | ||
| data, err := os.ReadFile(filepath.Join(dir, kptfilev1.KptFileName)) | ||
| if err != nil { | ||
| return "" | ||
| } | ||
| var kf kptfilev1.KptFile | ||
| d := yaml.NewDecoder(bytes.NewReader(data)) | ||
| if err := d.Decode(&kf); err != nil { | ||
| return "" | ||
| } | ||
| if kf.Upstream != nil { | ||
| return PkgTypeIndependent | ||
| } | ||
| return name | ||
| return PkgTypeDependent | ||
| } |
| pkgType := packageType(p.Root) | ||
| if pkgType == PkgTypeIndependent { | ||
| tree.SetValue(fmt.Sprintf(PkgNameFormat+" (%s)", filepath.Base(p.Root), pkgType)) | ||
| } else { | ||
| tree.SetValue(fmt.Sprintf(PkgNameFormat, filepath.Base(p.Root))) | ||
| } |
| ├── [deployment.yaml] Deployment wordpress-mysql | ||
| └── [deployment.yaml] Service wordpress-mysql |



Description
kpt pkg treecommand now annotates packages with(independent)or(dependent)based on whether their Kptfile contains anupstreamsection.pkg treemakes package composition visible at a glance.packageType()function inthirdparty/cmdconfig/commands/cmdtree/tree.goreads each package's Kptfile (using lenient YAML decoding) and checks for the presence of theUpstreamfield. Subpackages are always annotated; root packages only show(independent)when they have an upstream source, a locally created root (e.g. viakpt pkg init) shows no annotation since it has no parent to be "dependent" on.Related Issue(s)
treecommand should optionally (?) show whether a package is dependent or independent #1845Type of Change
Checklist
AI Disclosure
If so, please describe how:
- Kiro to analyse the issue, validate/update the changes, write tests, and update documentation.