Skip to content

Adds language model tool that creates new spfx projects. Closes #707, #705 - #852

Draft
Adam-it wants to merge 2 commits into
pnp:devfrom
Adam-it:refactors-new-chat-command-to-lm-tool
Draft

Adam-it wants to merge 2 commits into
pnp:devfrom
Adam-it:refactors-new-chat-command-to-lm-tool

Conversation

@Adam-it

@Adam-it Adam-it commented Jul 29, 2026 •

Copy link
Copy Markdown
Member

🎯 Aim

The aim of this PR is to depreacte the chat participant and remove the /new chat command and refactor it to a dedicated language model tool that will execute the best yo command to create and SPFx project for user prompt

📷 Result

image image image image image

✅ What was done

  • Removes the new chat participant command
  • Updates docs and readme
  • Adds a new langauge model tool that createst he best yo command for user prompt and executes it

🔗 Related issue

Closes #707, #705

@Adam-it Adam-it changed the title Adds language model tool that creates new spfx projects. Closes #707 Adds language model tool that creates new spfx projects. Closes #707, #705 Jul 29, 2026
@Adam-it Adam-it linked an issue Jul 29, 2026 that may be closed by this pull request
2 of 3 tasks
@Adam-it
Adam-it changed the base branch from main to dev July 29, 2026 21:52
@Adam-it

Adam-it commented Aug 2, 2026 •

Copy link
Copy Markdown
Member Author

just noticed when doing different stuf that we should also remove

actionCommands.push(new ActionTreeItem('Use @spfx in GitHub Copilot ', '', { name: 'copilot', custom: false }, undefined, Commands.openCopilot));

and

actionCommands.push(new ActionTreeItem('Use @spfx in GitHub Copilot ', '', { name: 'copilot', custom: false }, undefined, Commands.openCopilot));

and
https://github.com/pnp/vscode-viva/blob/main/src/services/actions/CopilotActions.ts

with this change

@Adam-it
Adam-it marked this pull request as draft August 2, 2026 22:07
@Adam-it
Adam-it marked this pull request as ready for review August 3, 2026 09:44
@Adam-it

Adam-it commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

just noticed when doing different stuf that we should also remove

actionCommands.push(new ActionTreeItem('Use @spfx in GitHub Copilot ', '', { name: 'copilot', custom: false }, undefined, Commands.openCopilot));

and

actionCommands.push(new ActionTreeItem('Use @spfx in GitHub Copilot ', '', { name: 'copilot', custom: false }, undefined, Commands.openCopilot));

and https://github.com/pnp/vscode-viva/blob/main/src/services/actions/CopilotActions.ts

with this change

done ✅

@nicodecleyre nicodecleyre self-assigned this Aug 10, 2026
@Adam-it
Adam-it force-pushed the refactors-new-chat-command-to-lm-tool branch from e94ff50 to 223104a Compare September 9, 2026 21:06
Comment on lines +85 to +89
await Scaffolder.createProjectCopilot(yoCommand);

const response = `Created and executed the following SPFx command:\n\n\`\`\`\n${yoCommand}\n\`\`\``;

return new LanguageModelToolResult([new LanguageModelTextPart(response)]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works great, but not when you are in a workspace root on an existing SPFx solution where you already have a package.json. Then it produces a target folder containing only .yo-rc.json& project.pnp

Image

So... The generator logs No change to package.json was detected. No package manager install will be executed. and exits 0, because createProjectCopilot always runs yo with workspace.workspaceFolders[0] as current working directory, and the generator picks up that ambient package.json and treats the call as "nothing to do" instead of scaffolding a fresh, independent solution in the target subfolder.

Scaffolding into a workspace root that is not itself an existing SPFx project works fine every time.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right. So you mean for a scenario in which you already have an SPFx project and would like to extend it with additional SPFx component right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, either it adds the right SPFx component, or it creates a new project in the existing project. But I would suggest the first 😄

const yoCommand = commandParts.join(' ');

await Scaffolder.createProjectCopilot(yoCommand);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skipInstall gets append if it's not already present unconditionally.

In the agent:

Image

In the output:

Image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually by design. We should scaffold a new project as fast as possible with skip install and reopen VS code in it and only then run npm install once VS Code is reopened in the newly created project.
Do you think this follow is correct? or what do you think we should correct?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Ok to scaffold a new project as fast as possible. But then again, if the user adds the skip install parameter, it will still install the packages when VS reopens. Doesn't that feels contradictory?

@nicodecleyre

Copy link
Copy Markdown
Contributor

Great work so far @Adam-it 👏; Can you take a look at the comments i left? Thank you!

@Adam-it

Adam-it commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

hey we just had a new minor release which means we aligned out main branch with dev. Please perform a rebase so we may proceed with a PR. You Rock 🤩

@Adam-it
Adam-it force-pushed the refactors-new-chat-command-to-lm-tool branch 2 times, most recently from f88b65d to 4c99474 Compare October 10, 2026 23:25
@nicodecleyre

Copy link
Copy Markdown
Contributor

Hi @Adam-it 👋 We just released v4.23.0 and the dev branch was realigned with main (force push). Could you please rebase your branch on the latest dev? Thank you! 🙏

git fetch upstream
git rebase upstream/dev
git push --force-with-lease

@Adam-it
Adam-it force-pushed the refactors-new-chat-command-to-lm-tool branch from 4c99474 to 67d0dca Compare November 11, 2026 23:37

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor the /new chat command to a dedicated SPFx new project LM tool Drop @spfx GitHub Copilot Chat participant

2 participants