@stacksjs/buddy 0.75.19 → 0.75.20
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/dist/commands/setup-ai.js +1 -1
- package/package.json +53 -53
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{cpSync,existsSync,lstatSync,mkdirSync,readdirSync,rmSync,symlinkSync,writeFileSync}from"node:fs";import process from"node:process";import{dim,green,log,yellow}from"@stacksjs/cli";import{frameworkPath,join,projectPath,relative}from"@stacksjs/path";import{listSkills,resolveSkillPath}from"@stacksjs/skills";export const AI_PROVIDERS=[{id:"claude",label:"Claude Code",reads:["AGENTS.md","CLAUDE.md",".claude/skills",".claude/launch.json"]},{id:"codex",label:"OpenAI Codex CLI",reads:["AGENTS.md"]},{id:"cursor",label:"Cursor",reads:["AGENTS.md",".cursor/rules"]},{id:"copilot",label:"GitHub Copilot",reads:["AGENTS.md",".github/copilot-instructions.md"]},{id:"gemini",label:"Gemini CLI",reads:["AGENTS.md","GEMINI.md"]}];export function isAiProvider(value){return AI_PROVIDERS.some((provider)=>provider.id===value)}export function materialize(target,path,options){const existing=lstatSync(path,{throwIfNoEntry:!1});if(existing){if(!existing.isSymbolicLink()&&!options.force)return!1;rmSync(path,{recursive:!0,force:!0})}mkdirSync(join(path,".."),{recursive:!0});if(options.copy)cpSync(target,path,{recursive:!0});else symlinkSync(relative(join(path,".."),target),path,process.platform==="win32"?"junction":"dir");return!0}function materializeFile(source,path,options){if(existsSync(path)&&!options.force)return!1;mkdirSync(join(path,".."),{recursive:!0});cpSync(source,path,{recursive:!0,force:!0});return!0}function installSkills(destination,options){const names=listSkills();let installed=0,skipped=0;mkdirSync(destination,{recursive:!0});for(const entry of readdirSync(destination)){const path=join(destination,entry);if(lstatSync(path,{throwIfNoEntry:!1})?.isSymbolicLink()&&!existsSync(path))rmSync(path,{force:!0})}for(const name of names){const source=resolveSkillPath(name);if(!source)continue;if(materialize(source,join(destination,name),options))installed++;else skipped++}return{installed,skipped}}export function setupAiProvider(provider,options={}){const created=[],skipped=[],defaults=frameworkPath("defaults/ai"),rel=(path)=>relative(projectPath(),path),record=(path,didCreate)=>{(didCreate?created:skipped).push(rel(path))},agents=projectPath("AGENTS.md");record(agents,materializeFile(join(defaults,"AGENTS.md"),agents,{...options,force:!1}));switch(provider){case"claude":{const claudeMd=projectPath("CLAUDE.md"),linked=materialize(agents,claudeMd,{...options,copy:!1,force:!1});record(claudeMd,linked);if(!linked&&existsSync(claudeMd)&&!lstatSync(claudeMd,{throwIfNoEntry:!1})?.isSymbolicLink())log.info(` \xB7 ${rel(claudeMd)} is a real file, so it is left as-is. Move its content into AGENTS.md and delete it to have both agents read one file.`);const launch=projectPath(".claude/launch.json");record(launch,materializeFile(join(defaults,"claude/launch.json"),launch,options));const skillsDir=projectPath(".claude/skills"),{installed,skipped:untouched}=installSkills(skillsDir,options);if(installed>0)created.push(`${rel(skillsDir)} (${installed} skills)`);if(untouched>0)skipped.push(`${rel(skillsDir)} (${untouched} skills)`);break}case"codex":break;case"cursor":{const rules=projectPath(".cursor/rules");record(rules,materialize(frameworkPath("defaults/ide/cursor/rules"),rules,options));break}case"copilot":{const instructions=projectPath(".github/copilot-instructions.md");if(existsSync(instructions)&&!options.force)skipped.push(rel(instructions));else{mkdirSync(projectPath(".github"),{recursive:!0});writeFileSync(instructions,pointerFile("AGENTS.md"),"utf8");created.push(rel(instructions))}break}case"gemini":{const geminiMd=projectPath("GEMINI.md");record(geminiMd,materialize(agents,geminiMd,{...options,copy:!1}));break}}return{created,skipped}}function pointerFile(target){return["# Project instructions","",`This project keeps its agent guidance in [\`${target}\`](../${target}), so every`,"agent works from the same rules. Read that file.","","Regenerate this pointer with `buddy setup:ai copilot --force`.",""].join(`
|
|
1
|
+
import{cpSync,existsSync,lstatSync,mkdirSync,readdirSync,rmSync,symlinkSync,writeFileSync}from"node:fs";import process from"node:process";import{dim,green,log,yellow}from"@stacksjs/cli";import{frameworkPath,join,projectPath,relative}from"@stacksjs/path";import{listSkills,resolveSkillPath}from"@stacksjs/skills";export const AI_PROVIDERS=[{id:"claude",label:"Claude Code",reads:["AGENTS.md","CLAUDE.md",".claude/skills",".claude/launch.json"]},{id:"codex",label:"OpenAI Codex CLI",reads:["AGENTS.md"]},{id:"cursor",label:"Cursor",reads:["AGENTS.md",".cursor/rules"]},{id:"copilot",label:"GitHub Copilot",reads:["AGENTS.md",".github/copilot-instructions.md"]},{id:"gemini",label:"Gemini CLI",reads:["AGENTS.md","GEMINI.md"]}];export function isAiProvider(value){return AI_PROVIDERS.some((provider)=>provider.id===value)}export function materialize(target,path,options){const existing=lstatSync(path,{throwIfNoEntry:!1});if(existing){if(!existing.isSymbolicLink()&&!options.force)return!1;rmSync(path,{recursive:!0,force:!0})}mkdirSync(join(path,".."),{recursive:!0});if(options.copy)cpSync(target,path,{recursive:!0});else symlinkSync(relative(join(path,".."),target),path,process.platform==="win32"?"junction":"dir");return!0}function materializeFile(source,path,options){if(existsSync(path)&&!options.force)return!1;mkdirSync(join(path,".."),{recursive:!0});cpSync(source,path,{recursive:!0,force:!0});return!0}function installSkills(destination,options){const names=listSkills();let installed=0,skipped=0;mkdirSync(destination,{recursive:!0});for(const entry of readdirSync(destination)){const path=join(destination,entry);if(lstatSync(path,{throwIfNoEntry:!1})?.isSymbolicLink()&&!existsSync(path))rmSync(path,{force:!0})}for(const name of names){const source=resolveSkillPath(name);if(!source)continue;if(materialize(source,join(destination,name),options))installed++;else skipped++}return{installed,skipped}}export function setupAiProvider(provider,options={}){const created=[],skipped=[],defaults=frameworkPath("defaults/ai"),rel=(path)=>relative(projectPath(),path),record=(path,didCreate)=>{(didCreate?created:skipped).push(rel(path))},agents=projectPath("AGENTS.md");record(agents,materializeFile(join(defaults,"AGENTS.md"),agents,{...options,force:!1}));switch(provider){case"claude":{const claudeMd=projectPath("CLAUDE.md"),linked=materialize(agents,claudeMd,{...options,copy:!1,force:!1});record(claudeMd,linked);if(!linked&&existsSync(claudeMd)&&!lstatSync(claudeMd,{throwIfNoEntry:!1})?.isSymbolicLink())log.info(` \xB7 ${rel(claudeMd)} is a real file, so it is left as-is. Move its content into AGENTS.md and delete it to have both agents read one file.`);const launch=projectPath(".claude/launch.json");record(launch,materializeFile(join(defaults,"claude/launch.json"),launch,{...options,force:!1}));const skillsDir=projectPath(".claude/skills"),{installed,skipped:untouched}=installSkills(skillsDir,options);if(installed>0)created.push(`${rel(skillsDir)} (${installed} skills)`);if(untouched>0)skipped.push(`${rel(skillsDir)} (${untouched} skills)`);break}case"codex":break;case"cursor":{const rules=projectPath(".cursor/rules");record(rules,materialize(frameworkPath("defaults/ide/cursor/rules"),rules,options));break}case"copilot":{const instructions=projectPath(".github/copilot-instructions.md");if(existsSync(instructions)&&!options.force)skipped.push(rel(instructions));else{mkdirSync(projectPath(".github"),{recursive:!0});writeFileSync(instructions,pointerFile("AGENTS.md"),"utf8");created.push(rel(instructions))}break}case"gemini":{const geminiMd=projectPath("GEMINI.md");record(geminiMd,materialize(agents,geminiMd,{...options,copy:!1}));break}}return{created,skipped}}function pointerFile(target){return["# Project instructions","",`This project keeps its agent guidance in [\`${target}\`](../${target}), so every`,"agent works from the same rules. Read that file.","","Regenerate this pointer with `buddy setup:ai copilot --force`.",""].join(`
|
|
2
2
|
`)}export function reportAiSetup(provider,result){for(const path of result.created)log.info(` ${green("+")} ${path}`);for(const path of result.skipped)log.info(` ${yellow("\xB7")} ${path} ${dim("(already present, left alone)")}`);if(result.created.length===0)log.info(dim(" Nothing to do - re-run with --force to overwrite."));log.success(`${provider.label} is set up. It reads: ${provider.reads.join(", ")}`)}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/buddy",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.20",
|
|
6
6
|
"description": "Meet Buddy. The Stacks runtime.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -95,66 +95,66 @@
|
|
|
95
95
|
"prepublishOnly": "bun run build"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@stacksjs/actions": "^0.75.
|
|
99
|
-
"@stacksjs/ai": "^0.75.
|
|
100
|
-
"@stacksjs/alias": "^0.75.
|
|
101
|
-
"@stacksjs/analytics": "^0.75.
|
|
102
|
-
"@stacksjs/api": "^0.75.
|
|
103
|
-
"@stacksjs/arrays": "^0.75.
|
|
104
|
-
"@stacksjs/auth": "^0.75.
|
|
105
|
-
"@stacksjs/browser-extension": "^0.75.
|
|
106
|
-
"@stacksjs/build": "^0.75.
|
|
107
|
-
"@stacksjs/cache": "^0.75.
|
|
108
|
-
"@stacksjs/chat": "^0.75.
|
|
98
|
+
"@stacksjs/actions": "^0.75.20",
|
|
99
|
+
"@stacksjs/ai": "^0.75.20",
|
|
100
|
+
"@stacksjs/alias": "^0.75.20",
|
|
101
|
+
"@stacksjs/analytics": "^0.75.20",
|
|
102
|
+
"@stacksjs/api": "^0.75.20",
|
|
103
|
+
"@stacksjs/arrays": "^0.75.20",
|
|
104
|
+
"@stacksjs/auth": "^0.75.20",
|
|
105
|
+
"@stacksjs/browser-extension": "^0.75.20",
|
|
106
|
+
"@stacksjs/build": "^0.75.20",
|
|
107
|
+
"@stacksjs/cache": "^0.75.20",
|
|
108
|
+
"@stacksjs/chat": "^0.75.20",
|
|
109
109
|
"@stacksjs/clapp": "^0.2.12",
|
|
110
|
-
"@stacksjs/cli": "^0.75.
|
|
111
|
-
"@stacksjs/cloud": "^0.75.
|
|
112
|
-
"@stacksjs/cms": "^0.75.
|
|
113
|
-
"@stacksjs/collections": "^0.75.
|
|
114
|
-
"@stacksjs/config": "^0.75.
|
|
115
|
-
"@stacksjs/database": "^0.75.
|
|
116
|
-
"@stacksjs/desktop-build": "^0.75.
|
|
117
|
-
"@stacksjs/dns": "^0.75.
|
|
110
|
+
"@stacksjs/cli": "^0.75.20",
|
|
111
|
+
"@stacksjs/cloud": "^0.75.20",
|
|
112
|
+
"@stacksjs/cms": "^0.75.20",
|
|
113
|
+
"@stacksjs/collections": "^0.75.20",
|
|
114
|
+
"@stacksjs/config": "^0.75.20",
|
|
115
|
+
"@stacksjs/database": "^0.75.20",
|
|
116
|
+
"@stacksjs/desktop-build": "^0.75.20",
|
|
117
|
+
"@stacksjs/dns": "^0.75.20",
|
|
118
118
|
"@stacksjs/dnsx": "^0.2.3",
|
|
119
|
-
"@stacksjs/email": "^0.75.
|
|
120
|
-
"@stacksjs/enums": "^0.75.
|
|
121
|
-
"@stacksjs/env": "^0.75.
|
|
122
|
-
"@stacksjs/error-handling": "^0.75.
|
|
123
|
-
"@stacksjs/events": "^0.75.
|
|
124
|
-
"@stacksjs/features": "^0.75.
|
|
125
|
-
"@stacksjs/git": "^0.75.
|
|
119
|
+
"@stacksjs/email": "^0.75.20",
|
|
120
|
+
"@stacksjs/enums": "^0.75.20",
|
|
121
|
+
"@stacksjs/env": "^0.75.20",
|
|
122
|
+
"@stacksjs/error-handling": "^0.75.20",
|
|
123
|
+
"@stacksjs/events": "^0.75.20",
|
|
124
|
+
"@stacksjs/features": "^0.75.20",
|
|
125
|
+
"@stacksjs/git": "^0.75.20",
|
|
126
126
|
"@stacksjs/gitit": "^0.2.5",
|
|
127
|
-
"@stacksjs/health": "^0.75.
|
|
127
|
+
"@stacksjs/health": "^0.75.20",
|
|
128
128
|
"@stacksjs/httx": "^0.1.10",
|
|
129
|
-
"@stacksjs/image": "^0.75.
|
|
130
|
-
"@stacksjs/lint": "^0.75.
|
|
131
|
-
"@stacksjs/logging": "^0.75.
|
|
132
|
-
"@stacksjs/notifications": "^0.75.
|
|
133
|
-
"@stacksjs/objects": "^0.75.
|
|
134
|
-
"@stacksjs/orm": "^0.75.
|
|
135
|
-
"@stacksjs/path": "^0.75.
|
|
136
|
-
"@stacksjs/payments": "^0.75.
|
|
137
|
-
"@stacksjs/realtime": "^0.75.
|
|
138
|
-
"@stacksjs/router": "^0.75.
|
|
129
|
+
"@stacksjs/image": "^0.75.20",
|
|
130
|
+
"@stacksjs/lint": "^0.75.20",
|
|
131
|
+
"@stacksjs/logging": "^0.75.20",
|
|
132
|
+
"@stacksjs/notifications": "^0.75.20",
|
|
133
|
+
"@stacksjs/objects": "^0.75.20",
|
|
134
|
+
"@stacksjs/orm": "^0.75.20",
|
|
135
|
+
"@stacksjs/path": "^0.75.20",
|
|
136
|
+
"@stacksjs/payments": "^0.75.20",
|
|
137
|
+
"@stacksjs/realtime": "^0.75.20",
|
|
138
|
+
"@stacksjs/router": "^0.75.20",
|
|
139
139
|
"@stacksjs/rpx": "^0.11.54",
|
|
140
|
-
"@stacksjs/scheduler": "^0.75.
|
|
141
|
-
"@stacksjs/search-engine": "^0.75.
|
|
142
|
-
"@stacksjs/security": "^0.75.
|
|
143
|
-
"@stacksjs/server": "^0.75.
|
|
144
|
-
"@stacksjs/sites": "^0.75.
|
|
145
|
-
"@stacksjs/skills": "^0.75.
|
|
146
|
-
"@stacksjs/storage": "^0.75.
|
|
147
|
-
"@stacksjs/strings": "^0.75.
|
|
140
|
+
"@stacksjs/scheduler": "^0.75.20",
|
|
141
|
+
"@stacksjs/search-engine": "^0.75.20",
|
|
142
|
+
"@stacksjs/security": "^0.75.20",
|
|
143
|
+
"@stacksjs/server": "^0.75.20",
|
|
144
|
+
"@stacksjs/sites": "^0.75.20",
|
|
145
|
+
"@stacksjs/skills": "^0.75.20",
|
|
146
|
+
"@stacksjs/storage": "^0.75.20",
|
|
147
|
+
"@stacksjs/strings": "^0.75.20",
|
|
148
148
|
"@stacksjs/stx": "^0.2.325",
|
|
149
|
-
"@stacksjs/testing": "^0.75.
|
|
150
|
-
"@stacksjs/tinker": "^0.75.
|
|
149
|
+
"@stacksjs/testing": "^0.75.20",
|
|
150
|
+
"@stacksjs/tinker": "^0.75.20",
|
|
151
151
|
"@stacksjs/tlsx": "^0.13.19",
|
|
152
152
|
"@stacksjs/ts-cloud": "^0.16.15",
|
|
153
|
-
"@stacksjs/tunnel": "^0.75.
|
|
154
|
-
"@stacksjs/types": "^0.75.
|
|
155
|
-
"@stacksjs/ui": "^0.75.
|
|
156
|
-
"@stacksjs/utils": "^0.75.
|
|
157
|
-
"@stacksjs/validation": "^0.75.
|
|
153
|
+
"@stacksjs/tunnel": "^0.75.20",
|
|
154
|
+
"@stacksjs/types": "^0.75.20",
|
|
155
|
+
"@stacksjs/ui": "^0.75.20",
|
|
156
|
+
"@stacksjs/utils": "^0.75.20",
|
|
157
|
+
"@stacksjs/validation": "^0.75.20",
|
|
158
158
|
"ajv": "^8.20.0",
|
|
159
159
|
"ajv-formats": "^3.0.1",
|
|
160
160
|
"bun-plugin-stx": "^0.2.324",
|