Task: Implement a small Seneca plugin in /app/ that provides a urlmatcher factory.
What to implement
Create /app/index.js exporting a CommonJS function that can be used as a Seneca plugin (e.g., module.exports = function urlMatcherPlugin(opts) { ... }).
The plugin must register an action for role: 'auth', cmd: 'urlmatcher' (this.add('role:auth,cmd:urlmatcher', ...)).
The action should read msg.spec and respond with an array of matcher functions according to the following rules:
If spec is a string: return an array with a single function in it.
If spec is an array: return an array with the same length, containing one function per entry (the actual value of the function is not important for tests, it just needs to be a function).
If spec is a function: return an array containing that function.
For any other spec value: return an empty array.
The action must reply with (err, result) where err is null and result is the computed array.
The functions inside the returned array can be no-ops; the tests only verify that the result is an array of functions and the correct length.
The plugin should be robust to multiple invocations and not rely on external state.
Requirements to pass the tests
Located at /app/index.js and usable via si.use(require('..')) in tests.
Correct handling of the three test cases:
spec: '/api' should yield an array of length 1 with a function.
spec: ['/api', '/api2'] should yield an array of length 2 with two functions.
spec: function () {} should yield an array of length 1 with a function (the same function provided).
The action must always call the reply callback with err = null when successful.
Notes
Do not add external dependencies.
Use strict mode.
The solution should be self-contained and ready to be placed in /app/ as index.js (or as a module that /app/index.js exports).