@sylphx/flow 0.0.5 → 0.0.7
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/chunk-b2zeg2wa.js +3 -0
- package/dist/chunk-b2zeg2wa.js.map +10 -0
- package/dist/{chunk-pcm6twpw.js → chunk-qctnd9ga.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +6 -6
- package/package.json +1 -1
- package/dist/chunk-7wd1res1.js +0 -3
- package/dist/chunk-7wd1res1.js.map +0 -10
- /package/dist/{chunk-pcm6twpw.js.map → chunk-qctnd9ga.js.map} +0 -0
package/package.json
CHANGED
package/dist/chunk-7wd1res1.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{F as B,I as D}from"./chunk-x46tzzn9.js";var A=()=>{let q=process.argv,b=q[0],w=q[1];if(w.includes("/_npx/")&&w.includes("github"))return{type:"github",repo:"github:sylphxltd/flow"};if(w.includes("/_npx/")){let z=w.match(/@sylphx\/flow|@sylphxltd\/flow/);return{type:"npm",package:z?z[0]:"@sylphx/flow"}}if(b.includes("bun")&&!w.includes(process.cwd()))return{type:"bunx",package:"@sylphx/flow"};if(w.includes(process.cwd())){if(b.includes("bun"))return{type:"local-dev",script:"bun run dev"};return{type:"local-dev",script:"npm run dev"}}if(w.includes("node_modules/.bin")||w.includes("/bin/sylphx-flow"))return{type:"global",command:"sylphx-flow"};return{type:"unknown"}},E=(q)=>{let b=q||A();switch(b.type){case"npm":return`npx -y ${b.package}`;case"github":return`npx -y ${b.repo}`;case"bunx":return`bunx ${b.package}`;case"local-dev":return b.script;case"global":return b.command;case"unknown":return"npx -y @sylphx/flow"}},F=(q)=>{let b=q||A();switch(b.type){case"npm":return["-y",b.package,"mcp","start"];case"github":return["-y",b.repo,"mcp","start"];case"bunx":return[b.package,"mcp","start"];case"local-dev":return["./dist/index.js","mcp","start"];case"global":return[b.command,"mcp","start"];case"unknown":return["-y","@sylphx/flow","mcp","start"]}},G=(q)=>{switch((q||A()).type){case"npm":case"github":return"npx";case"bunx":return"bunx";case"local-dev":return process.execPath.includes("bun")?"bun":"node";case"global":case"unknown":return"npx"}},H=(q,b,w)=>{return`${E(w)} hook --type ${q} --target ${b}`},J=async(q)=>{let{updateSettings:b}=await import("./chunk-02jj9ahn.js");await b({invocationMethod:q})},K=async()=>{let{loadSettings:q}=await import("./chunk-02jj9ahn.js"),b=await q();if(b._tag==="Success")return b.value.invocationMethod;return};export{J as saveInvocationMethod,K as loadInvocationMethod,G as getMCPServerCommand,F as getMCPServerArgs,E as getCommandPrefix,H as generateHookCommand,A as detectInvocation};
|
|
2
|
-
|
|
3
|
-
//# debugId=572E9DC3588E6C4B64756E2164756E21
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/utils/cli-invocation.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * CLI Invocation Detection\n * Detects how the CLI was invoked and generates appropriate commands\n *\n * Supports common invocation methods:\n * - npm/npx (most common)\n * - GitHub direct (for bleeding edge)\n * - Bun/bunx (emerging)\n * - Local development (bun/npm run dev)\n * - Global installation\n * - Unknown methods fallback to npm (safe default)\n */\n\n/**\n * Invocation method types\n */\nexport type InvocationMethod =\n | { type: 'npm'; package: string }\n | { type: 'github'; repo: string }\n | { type: 'bunx'; package: string }\n | { type: 'local-dev'; script: string }\n | { type: 'global'; command: string }\n | { type: 'unknown' };\n\n/**\n * Detect how the CLI was invoked\n * Examines process.argv to determine invocation method\n */\nexport const detectInvocation = (): InvocationMethod => {\n const argv = process.argv;\n const execPath = argv[0]; // node/bun executable path\n const scriptPath = argv[1]; // script being executed\n\n // Check if running via npx with github\n if (scriptPath.includes('/_npx/') && scriptPath.includes('github')) {\n return { type: 'github', repo: 'github:sylphxltd/flow' };\n }\n\n // Check if running via npx with npm package\n if (scriptPath.includes('/_npx/')) {\n // Extract package name from path\n const match = scriptPath.match(/@sylphx\\/flow|@sylphxltd\\/flow/);\n return { type: 'npm', package: match ? match[0] : '@sylphx/flow' };\n }\n\n // Check if running via bunx\n if (execPath.includes('bun') && !scriptPath.includes(process.cwd())) {\n return { type: 'bunx', package: '@sylphx/flow' };\n }\n\n // Check if running locally in development\n if (scriptPath.includes(process.cwd())) {\n // Check if using bun run dev or npm run dev\n if (execPath.includes('bun')) {\n return { type: 'local-dev', script: 'bun run dev' };\n }\n return { type: 'local-dev', script: 'npm run dev' };\n }\n\n // Check if globally installed\n if (scriptPath.includes('node_modules/.bin') || scriptPath.includes('/bin/sylphx-flow')) {\n return { type: 'global', command: 'sylphx-flow' };\n }\n\n return { type: 'unknown' };\n};\n\n/**\n * Generate command prefix based on invocation method\n * Used for generating hook commands, MCP configs, etc.\n */\nexport const getCommandPrefix = (method?: InvocationMethod): string => {\n const invocation = method || detectInvocation();\n\n switch (invocation.type) {\n case 'npm':\n return `npx -y ${invocation.package}`;\n\n case 'github':\n return `npx -y ${invocation.repo}`;\n\n case 'bunx':\n return `bunx ${invocation.package}`;\n\n case 'local-dev':\n return invocation.script;\n\n case 'global':\n return invocation.command;\n\n case 'unknown':\n // Fallback to npm package (safe default)\n return 'npx -y @sylphx/flow';\n }\n};\n\n/**\n * Generate MCP server args array based on invocation\n */\nexport const getMCPServerArgs = (method?: InvocationMethod): string[] => {\n const invocation = method || detectInvocation();\n\n switch (invocation.type) {\n case 'npm':\n return ['-y', invocation.package, 'mcp', 'start'];\n\n case 'github':\n return ['-y', invocation.repo, 'mcp', 'start'];\n\n case 'bunx':\n return [invocation.package, 'mcp', 'start'];\n\n case 'local-dev':\n // For local dev, use the built dist\n return ['./dist/index.js', 'mcp', 'start'];\n\n case 'global':\n return [invocation.command, 'mcp', 'start'];\n\n case 'unknown':\n // Fallback to npm\n return ['-y', '@sylphx/flow', 'mcp', 'start'];\n }\n};\n\n/**\n * Get MCP server command based on invocation\n */\nexport const getMCPServerCommand = (method?: InvocationMethod): string => {\n const invocation = method || detectInvocation();\n\n switch (invocation.type) {\n case 'npm':\n case 'github':\n return 'npx';\n\n case 'bunx':\n return 'bunx';\n\n case 'local-dev':\n // Use node or bun depending on what's running\n return process.execPath.includes('bun') ? 'bun' : 'node';\n\n case 'global':\n case 'unknown':\n return 'npx';\n }\n};\n\n/**\n * Generate hook command for specific hook type\n */\nexport const generateHookCommand = (\n hookType: 'session' | 'message' | 'notification',\n targetId: string,\n method?: InvocationMethod\n): string => {\n const prefix = getCommandPrefix(method);\n return `${prefix} hook --type ${hookType} --target ${targetId}`;\n};\n\n/**\n * Save invocation method to settings for future use\n */\nexport const saveInvocationMethod = async (method: InvocationMethod): Promise<void> => {\n const { updateSettings } = await import('./settings.js');\n await updateSettings({\n invocationMethod: method as any,\n });\n};\n\n/**\n * Load saved invocation method from settings\n */\nexport const loadInvocationMethod = async (): Promise<InvocationMethod | undefined> => {\n const { loadSettings } = await import('./settings.js');\n const result = await loadSettings();\n if (result._tag === 'Success') {\n return (result.value as any).invocationMethod;\n }\n return undefined;\n};\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": "+CA4BO,IAAM,EAAmB,IAAwB,CACtD,IAAM,EAAO,QAAQ,KACf,EAAW,EAAK,GAChB,EAAa,EAAK,GAGxB,GAAI,EAAW,SAAS,QAAQ,GAAK,EAAW,SAAS,QAAQ,EAC/D,MAAO,CAAE,KAAM,SAAU,KAAM,uBAAwB,EAIzD,GAAI,EAAW,SAAS,QAAQ,EAAG,CAEjC,IAAM,EAAQ,EAAW,MAAM,gCAAgC,EAC/D,MAAO,CAAE,KAAM,MAAO,QAAS,EAAQ,EAAM,GAAK,cAAe,EAInE,GAAI,EAAS,SAAS,KAAK,GAAK,CAAC,EAAW,SAAS,QAAQ,IAAI,CAAC,EAChE,MAAO,CAAE,KAAM,OAAQ,QAAS,cAAe,EAIjD,GAAI,EAAW,SAAS,QAAQ,IAAI,CAAC,EAAG,CAEtC,GAAI,EAAS,SAAS,KAAK,EACzB,MAAO,CAAE,KAAM,YAAa,O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