Package command plugins can't see plugin targets?

I'm getting to know package command plugins and I made a test plugin to learn how to work with the information a plugin can see.

Curiously, plugin targets do get submitted as arguments via Xcode when just running this plugin on the package in its entirety, but they don't appear in the context.package.targets list. Nor can you look for Plugin targets explicitly using context.package.targets(ofType: PluginTarget.self) it would seem.

Is this omission intentional? The formatting example would miss everything in the plugins folder, wouldn't it? What would be the recommended way to revise it to include the plugin targets' code, for example?

Note: I imported it into a different package with executable targets and tests and it saw them just fine.

(BTW, Was super stoked to discover ArgumentExtractor. Really makes writing a new command plugin way easier without having to figure out how to connect up ArgumentParser out of the gate. Thanks for that!)

The plugin in lives in Plugins/TellMeAboutYourself/plugin.swift as recommended in Create Package Plugins

import PackagePlugin
import Foundation


@main
struct TellMeAboutYourself: CommandPlugin {
    func performCommand(context: PackagePlugin.PluginContext,
                        arguments: [String]) async throws {
        
        let fileName = "WhatThePluginSees" + ".txt"
        
        var message = "Arguments Info"
        message.append("\narguments:\(arguments)")
        var argExtractor = ArgumentExtractor(arguments)
        let targetNames = argExtractor.extractOption(named: "target")
        message.append("\nextracted names:\(targetNames)")
        
        message.append("\n\nContext Info")
        message.append("\nworkDirectory: \(context.pluginWorkDirectory)")
        
        message.append("\n\nPackage Info")
        message.append("\norigin: \(context.package.origin)")
        message.append("\ndirectory: \(context.package.directory)")
        
        message.append("\nproducts:\(context.package.products.map({$0.name}))")
        message.append("\nall targets:\(context.package.targets.map({$0.name}))")
        
        //https://github.com/apple/swift-package-manager/blob/4b7ee3e328dc8e7bec33d4d5d401d37abead6e41/Sources/PackageModel/Target/PluginTarget.swift#L13
        //Cannot find 'PluginTarget' in scope
        //SwiftSourceModuleTarget.self does work. Not sure what else would yet.
        //let specialTargets = context.package.targets(ofType: PluginTarget.self)
        
        //Nope. No plugins in here.
        let targets = context.package.targets
        //FWIW not even if you asked for them explicitly with something like:
        //let targets = try context.package.targets(named: targetNames)
        let targetDirectories = targets.map({"\ndirectory for \($0.name): \($0.directory)"})
        for dir in targetDirectories {
            message.append(dir)
        }
        message.append("\n\n\n--------------------------------------------------------------------")
        message.append("\nFULL DUMP")
        message.append("\nsourceModules: \(context.package.sourceModules)")
        message.append("\nproducts:\(context.package.products)")
        message.append("\ntargets:\(context.package.targets)")
        
        
        
        var location = context.package.directory.appending([fileName])
        try writeToFile(location: location, content: message)
    }
    
    func writeToFile(location:Path, content:some StringProtocol) throws {
        try content.write(toFile: location.string, atomically: true, encoding: .utf8)
    }
}

with the following package file

// swift-tools-version: 5.9
import PackageDescription

let package = Package(
    name: "SwiftCodeTesterLib",
    platforms: [.macOS(.v13)],
    products: [
        .library(name: "CodeSketch", targets: ["CodeSketch"]),
        .plugin(name: "MakeCodeSketch", targets: ["MakeCodeSketch"]),
        .plugin(name: "TellMeAboutYourself", targets: ["TellMeAboutYourself"])
    ],
    targets: [
        .target(
            name: "CodeSketch",
            path: "Sources/CodeSketch"
        ),
        //MARK: Plugins
        .plugin(
            name: "MakeCodeSketch",
            capability: .command(intent: .custom(verb: "make-sketch", 
                                                 description: "Create an new code sketch"),
                                 permissions: [.writeToPackageDirectory(reason: "This plugin creates a new code sketch file.")])
        ),
        .plugin(
            name: "TellMeAboutYourself",
            capability: .command(intent: .custom(verb: "about",
                                                 description: "See info about the package"),
                                 permissions: [.writeToPackageDirectory(reason: "This plugin creates a file with information about the plugin and the package it's running on.")])
        )
    ]
)

Creates the following output (Minus the FULL DUMP)

Arguments Info
arguments:["--target", "CodeSketch", "--target", "TellMeAboutYourself", "--target", "MakeCodeSketch"]
extracted names:["CodeSketch", "TellMeAboutYourself", "MakeCodeSketch"]

Context Info
workDirectory: /MYDIRECTORY/Library/Developer/Xcode/DerivedData/SwiftCodeTesterLib-cwyucmvqapobyucyimamvmroqmql/SourcePackages/plugins/TellMeAboutYourself.output

Package Info
origin: root
directory: /MYDIRECTORY/Developer/SwiftNotes2024/SwiftCodeTesterLib
products:["CodeSketch"]
all targets:["CodeSketch"]
directory for CodeSketch: /MYDIRECTORY/Developer/SwiftNotes2024/SwiftCodeTesterLib/Sources/CodeSketch

repo with version of this plugin: GitHub - carlynorama/PluginExplorer: Repo for exploring how to make Package Plugins.