Skip to content

Commit 9b5ee88

Browse files
committed
address pr comments
1 parent 76e87dc commit 9b5ee88

7 files changed

Lines changed: 18 additions & 12 deletions

File tree

.mcp.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
"command": "node",
55
"args": [
66
"-e",
7-
"const fs=require('node:fs');const os=require('node:os');const path=require('node:path');const {pathToFileURL}=require('node:url');const serverName=process.argv[1];const rel=['scripts','mcp-wrapper.js'];const roots=[path.join(os.homedir(),'.codex','plugins','cache'),process.cwd()];const candidates=[];for(const root of roots){try{const stack=[root];while(stack.length){const dir=stack.pop();if(!fs.existsSync(dir))continue;const direct=path.join(dir,...rel);if(fs.existsSync(direct))candidates.push(direct);for(const entry of fs.readdirSync(dir,{withFileTypes:true})){if(entry.isDirectory())stack.push(path.join(dir,entry.name))}}}catch{}}const wrapper=candidates.find((p)=>p.includes(`${path.sep}nsolid-plugin${path.sep}`))||candidates[0];if(!wrapper){console.error('[nsolid-plugin] Could not locate Codex MCP wrapper. Reinstall with: codex plugin marketplace add NodeSource/nsolid-plugin && codex plugin add nsolid-plugin@nodesource');process.exit(1)}process.argv=[process.execPath,wrapper,serverName];import(pathToFileURL(wrapper).href)",
7+
"const fs=require('node:fs');const os=require('node:os');const path=require('node:path');const {pathToFileURL}=require('node:url');const serverName=process.argv[1];const rel=['scripts','mcp-wrapper.js'];const roots=[path.join(os.homedir(),'.codex','plugins','cache'),process.cwd()];const candidates=[];for(const root of roots){try{const stack=[root];while(stack.length){const dir=stack.pop();if(!fs.existsSync(dir))continue;const direct=path.join(dir,...rel);if(fs.existsSync(direct))candidates.push(direct);for(const entry of fs.readdirSync(dir,{withFileTypes:true})){if(entry.isDirectory())stack.push(path.join(dir,entry.name))}}}catch{}}const wrapper=candidates.find((p)=>p.includes(`${path.sep}nsolid-plugin${path.sep}`));if(!wrapper){console.error('[nsolid-plugin] Could not locate Codex MCP wrapper. Reinstall with: codex plugin marketplace add NodeSource/nsolid-plugin && codex plugin add nsolid-plugin@nodesource');process.exit(1)}process.argv=[process.execPath,wrapper,serverName];import(pathToFileURL(wrapper).href)",
88
"nsolid-console"
99
]
1010
},
1111
"ns-benchmark": {
1212
"command": "node",
1313
"args": [
1414
"-e",
15-
"const fs=require('node:fs');const os=require('node:os');const path=require('node:path');const {pathToFileURL}=require('node:url');const serverName=process.argv[1];const rel=['scripts','mcp-wrapper.js'];const roots=[path.join(os.homedir(),'.codex','plugins','cache'),process.cwd()];const candidates=[];for(const root of roots){try{const stack=[root];while(stack.length){const dir=stack.pop();if(!fs.existsSync(dir))continue;const direct=path.join(dir,...rel);if(fs.existsSync(direct))candidates.push(direct);for(const entry of fs.readdirSync(dir,{withFileTypes:true})){if(entry.isDirectory())stack.push(path.join(dir,entry.name))}}}catch{}}const wrapper=candidates.find((p)=>p.includes(`${path.sep}nsolid-plugin${path.sep}`))||candidates[0];if(!wrapper){console.error('[nsolid-plugin] Could not locate Codex MCP wrapper. Reinstall with: codex plugin marketplace add NodeSource/nsolid-plugin && codex plugin add nsolid-plugin@nodesource');process.exit(1)}process.argv=[process.execPath,wrapper,serverName];import(pathToFileURL(wrapper).href)",
15+
"const fs=require('node:fs');const os=require('node:os');const path=require('node:path');const {pathToFileURL}=require('node:url');const serverName=process.argv[1];const rel=['scripts','mcp-wrapper.js'];const roots=[path.join(os.homedir(),'.codex','plugins','cache'),process.cwd()];const candidates=[];for(const root of roots){try{const stack=[root];while(stack.length){const dir=stack.pop();if(!fs.existsSync(dir))continue;const direct=path.join(dir,...rel);if(fs.existsSync(direct))candidates.push(direct);for(const entry of fs.readdirSync(dir,{withFileTypes:true})){if(entry.isDirectory())stack.push(path.join(dir,entry.name))}}}catch{}}const wrapper=candidates.find((p)=>p.includes(`${path.sep}nsolid-plugin${path.sep}`));if(!wrapper){console.error('[nsolid-plugin] Could not locate Codex MCP wrapper. Reinstall with: codex plugin marketplace add NodeSource/nsolid-plugin && codex plugin add nsolid-plugin@nodesource');process.exit(1)}process.argv=[process.execPath,wrapper,serverName];import(pathToFileURL(wrapper).href)",
1616
"ns-benchmark"
1717
]
1818
},
1919
"ncm": {
2020
"command": "node",
2121
"args": [
2222
"-e",
23-
"const fs=require('node:fs');const os=require('node:os');const path=require('node:path');const {pathToFileURL}=require('node:url');const serverName=process.argv[1];const rel=['scripts','mcp-wrapper.js'];const roots=[path.join(os.homedir(),'.codex','plugins','cache'),process.cwd()];const candidates=[];for(const root of roots){try{const stack=[root];while(stack.length){const dir=stack.pop();if(!fs.existsSync(dir))continue;const direct=path.join(dir,...rel);if(fs.existsSync(direct))candidates.push(direct);for(const entry of fs.readdirSync(dir,{withFileTypes:true})){if(entry.isDirectory())stack.push(path.join(dir,entry.name))}}}catch{}}const wrapper=candidates.find((p)=>p.includes(`${path.sep}nsolid-plugin${path.sep}`))||candidates[0];if(!wrapper){console.error('[nsolid-plugin] Could not locate Codex MCP wrapper. Reinstall with: codex plugin marketplace add NodeSource/nsolid-plugin && codex plugin add nsolid-plugin@nodesource');process.exit(1)}process.argv=[process.execPath,wrapper,serverName];import(pathToFileURL(wrapper).href)",
23+
"const fs=require('node:fs');const os=require('node:os');const path=require('node:path');const {pathToFileURL}=require('node:url');const serverName=process.argv[1];const rel=['scripts','mcp-wrapper.js'];const roots=[path.join(os.homedir(),'.codex','plugins','cache'),process.cwd()];const candidates=[];for(const root of roots){try{const stack=[root];while(stack.length){const dir=stack.pop();if(!fs.existsSync(dir))continue;const direct=path.join(dir,...rel);if(fs.existsSync(direct))candidates.push(direct);for(const entry of fs.readdirSync(dir,{withFileTypes:true})){if(entry.isDirectory())stack.push(path.join(dir,entry.name))}}}catch{}}const wrapper=candidates.find((p)=>p.includes(`${path.sep}nsolid-plugin${path.sep}`));if(!wrapper){console.error('[nsolid-plugin] Could not locate Codex MCP wrapper. Reinstall with: codex plugin marketplace add NodeSource/nsolid-plugin && codex plugin add nsolid-plugin@nodesource');process.exit(1)}process.argv=[process.execPath,wrapper,serverName];import(pathToFileURL(wrapper).href)",
2424
"ncm"
2525
]
2626
}

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"bundle:sync": "node scripts/check-bundle-sync.mjs --sync",
2424
"bundle:check": "node scripts/check-bundle-sync.mjs --check",
2525
"prepublishOnly": "pnpm run build",
26-
"prepack": "pnpm run skills:sync && pnpm run bundle:sync && node -e \"require('node:fs').chmodSync('dist/src/cli.js', 0o755)\""
26+
"prepack": "pnpm run build && pnpm run skills:sync && pnpm run bundle:sync && node -e \"require('node:fs').chmodSync('dist/src/cli.js', 0o755)\""
2727
},
2828
"publishConfig": {
2929
"registry": "https://registry.npmjs.org/",

packages/pi-plugin/test/manifest.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('Pi plugin', () => {
2727
})
2828

2929
it('is publishable (not private)', () => {
30-
assert.strictEqual(pkg.private, undefined)
30+
assert.notStrictEqual(pkg.private, true)
3131
})
3232

3333
it('uses canonical root skills instead of committed package skill copies', () => {

scripts/materialize-github-marketplace.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ if (CHECK_MODE) {
7474
}
7575
console.log('plugin:root:check OK — root manifests match bundle.json.')
7676
} else {
77-
console.log(`Materialized GitHub marketplace/plugin layout at repository root (${expectedFiles.length} files).`)
77+
console.log(`Materialized GitHub marketplace/plugin layout at repository root (${expectedFiles.size} files).`)
7878
}
7979

8080
function buildExpectedFiles () {

scripts/mcp-wrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function readCredentials () {
3030
try {
3131
parsed = JSON.parse(readFileSync(AUTH_FILE, 'utf8'))
3232
} catch (err) {
33-
fail(`NodeSource credentials are unreadable. Run: npx -y @nodesource/nsolid-plugin logout && ${SETUP_COMMAND}. ${err.message}`)
33+
fail(`NodeSource credentials are unreadable. Run: npx -y nsolid-plugin logout && ${SETUP_COMMAND}. ${err.message}`)
3434
}
3535

3636
const required = ['serviceToken', 'organizationId', 'consoleUrl', 'expiresAt']

scripts/plugin-generators.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* the expected file contents as strings. Callers decide where to write them.
1010
*/
1111

12-
import { readFileSync, existsSync } from 'node:fs'
12+
import { readFileSync } from 'node:fs'
1313
import path from 'node:path'
1414
import { fileURLToPath } from 'node:url'
1515

@@ -117,7 +117,11 @@ export function generateCodexMcpJson (bundle) {
117117
}
118118

119119
export function generateCodexBootstrap () {
120-
return "const fs=require('node:fs');const os=require('node:os');const path=require('node:path');const {pathToFileURL}=require('node:url');const serverName=process.argv[1];const rel=['scripts','mcp-wrapper.js'];const roots=[path.join(os.homedir(),'.codex','plugins','cache'),process.cwd()];const candidates=[];for(const root of roots){try{const stack=[root];while(stack.length){const dir=stack.pop();if(!fs.existsSync(dir))continue;const direct=path.join(dir,...rel);if(fs.existsSync(direct))candidates.push(direct);for(const entry of fs.readdirSync(dir,{withFileTypes:true})){if(entry.isDirectory())stack.push(path.join(dir,entry.name))}}}catch{}}const wrapper=candidates.find((p)=>p.includes(`${path.sep}nsolid-plugin${path.sep}`))||candidates[0];if(!wrapper){console.error('[nsolid-plugin] Could not locate Codex MCP wrapper. Reinstall with: codex plugin marketplace add NodeSource/nsolid-plugin && codex plugin add nsolid-plugin@nodesource');process.exit(1)}process.argv=[process.execPath,wrapper,serverName];import(pathToFileURL(wrapper).href)"
120+
// Fail closed: only trust wrappers positively identified as this plugin's
121+
// install root (a path segment matching `nsolid-plugin`). Never fall back to
122+
// an unrelated discovered scripts/mcp-wrapper.js.
123+
// eslint-disable-next-line no-template-curly-in-string -- codegen: ${path.sep} must stay literal in the generated bootstrap string, it is evaluated at runtime in the host process
124+
return "const fs=require('node:fs');const os=require('node:os');const path=require('node:path');const {pathToFileURL}=require('node:url');const serverName=process.argv[1];const rel=['scripts','mcp-wrapper.js'];const roots=[path.join(os.homedir(),'.codex','plugins','cache'),process.cwd()];const candidates=[];for(const root of roots){try{const stack=[root];while(stack.length){const dir=stack.pop();if(!fs.existsSync(dir))continue;const direct=path.join(dir,...rel);if(fs.existsSync(direct))candidates.push(direct);for(const entry of fs.readdirSync(dir,{withFileTypes:true})){if(entry.isDirectory())stack.push(path.join(dir,entry.name))}}}catch{}}const wrapper=candidates.find((p)=>p.includes(`${path.sep}nsolid-plugin${path.sep}`));if(!wrapper){console.error('[nsolid-plugin] Could not locate Codex MCP wrapper. Reinstall with: codex plugin marketplace add NodeSource/nsolid-plugin && codex plugin add nsolid-plugin@nodesource');process.exit(1)}process.argv=[process.execPath,wrapper,serverName];import(pathToFileURL(wrapper).href)"
121125
}
122126

123127
export function generateAntigravityBootstrap () {
@@ -170,7 +174,7 @@ function readCredentials () {
170174
try {
171175
parsed = JSON.parse(readFileSync(AUTH_FILE, 'utf8'))
172176
} catch (err) {
173-
fail(\`NodeSource credentials are unreadable. Run: npx -y @nodesource/nsolid-plugin logout && \${SETUP_COMMAND}. \${err.message}\`)
177+
fail(\`NodeSource credentials are unreadable. Run: npx -y nsolid-plugin logout && \${SETUP_COMMAND}. \${err.message}\`)
174178
}
175179
176180
const required = ['serviceToken', 'organizationId', 'consoleUrl', 'expiresAt']

scripts/sync-plugin-assets.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,11 @@ function materializePiSkills () {
144144

145145
function checkSourceHygiene () {
146146
let drift = false
147-
// Reject any package-local skills dirs outside the canonical core source.
147+
// Reject any package-local skills dirs in removed/legacy plugin packages.
148+
// NOTE: packages/core is intentionally excluded — it legitimately materializes
149+
// a skills/ dir during prepack (skills:sync). Its presence is governed by
150+
// packages/core/scripts/sync-shared-skill-assets.mjs, not this hygiene check.
148151
const packageRoots = [
149-
path.join(ROOT, 'packages', 'core'),
150152
path.join(ROOT, 'packages', 'claude-plugin'),
151153
path.join(ROOT, 'packages', 'codex-plugin'),
152154
path.join(ROOT, 'packages', 'antigravity-plugin'),

0 commit comments

Comments
 (0)