@flighthq/tool-registry 0.3.1-next.616.aa7ae7f
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/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +7 -0
- package/dist/bin.js.map +1 -0
- package/dist/contract.d.ts +2 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +2 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/registryTool.d.ts +6 -0
- package/dist/registryTool.d.ts.map +1 -0
- package/dist/registryTool.js +15 -0
- package/dist/registryTool.js.map +1 -0
- package/package.json +51 -0
- package/src/registryTool.test.ts +33 -0
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runRegistryTool } from './registryTool';
|
|
3
|
+
process.exitCode = runRegistryTool(process.argv.slice(2), {
|
|
4
|
+
writeError: (message) => process.stderr.write(message),
|
|
5
|
+
writeOutput: (message) => process.stdout.write(message),
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACxD,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;IACtD,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;CACxD,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
package/dist/contract.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface RegistryToolIO {
|
|
2
|
+
readonly writeError: (message: string) => void;
|
|
3
|
+
readonly writeOutput: (message: string) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function runRegistryTool(args: readonly string[], io: Readonly<RegistryToolIO>): number;
|
|
6
|
+
//# sourceMappingURL=registryTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registryTool.d.ts","sourceRoot":"","sources":["../src/registryTool.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAID,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,MAAM,CAW7F"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BUILT_IN_REGISTRY_CATALOG_ENTRIES } from '@flighthq/registry-catalog/contract';
|
|
2
|
+
const USAGE = 'Usage: tool-registry catalog --json\n';
|
|
3
|
+
export function runRegistryTool(args, io) {
|
|
4
|
+
if (args.length === 1 && (args[0] === '--help' || args[0] === '-h')) {
|
|
5
|
+
io.writeOutput(USAGE);
|
|
6
|
+
return 0;
|
|
7
|
+
}
|
|
8
|
+
if (args.length === 2 && args[0] === 'catalog' && args[1] === '--json') {
|
|
9
|
+
io.writeOutput(`${JSON.stringify(BUILT_IN_REGISTRY_CATALOG_ENTRIES, null, 2)}\n`);
|
|
10
|
+
return 0;
|
|
11
|
+
}
|
|
12
|
+
io.writeError(USAGE);
|
|
13
|
+
return 1;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=registryTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registryTool.js","sourceRoot":"","sources":["../src/registryTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAOxF,MAAM,KAAK,GAAG,uCAAuC,CAAC;AAEtD,MAAM,UAAU,eAAe,CAAC,IAAuB,EAAE,EAA4B;IACnF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;QACpE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACtB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QACvE,EAAE,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,iCAAiC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAClF,OAAO,CAAC,CAAC;IACX,CAAC;IACD,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flighthq/tool-registry",
|
|
3
|
+
"version": "0.3.1-next.616.aa7ae7f",
|
|
4
|
+
"author": "Joshua Granick and other contributors",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/flighthq/flight.git",
|
|
9
|
+
"directory": "packages/tool-registry"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "dist/index.js",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./contract": {
|
|
20
|
+
"types": "./dist/contract.d.ts",
|
|
21
|
+
"default": "./dist/contract.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"bin": {
|
|
25
|
+
"tool-registry": "dist/bin.js"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"src/**/*.test.ts",
|
|
30
|
+
"!dist/**/*.test.js",
|
|
31
|
+
"!dist/**/*.test.d.ts",
|
|
32
|
+
"!dist/**/*.test.js.map",
|
|
33
|
+
"!dist/**/*.test.d.ts.map"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc -b",
|
|
37
|
+
"clean": "tsc -b --clean",
|
|
38
|
+
"test": "vitest run --config vitest.config.ts",
|
|
39
|
+
"test:watch": "vitest --watch --config vitest.config.ts",
|
|
40
|
+
"prepack": "npm run clean && npm run clean:dist && npm run build",
|
|
41
|
+
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@flighthq/registry-catalog": "0.3.1-next.616.aa7ae7f"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"typescript": "^5.3.0"
|
|
48
|
+
},
|
|
49
|
+
"description": "Command-line access to registry inventory without choosing generated source policy",
|
|
50
|
+
"sideEffects": false
|
|
51
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { runRegistryTool } from './registryTool';
|
|
2
|
+
|
|
3
|
+
function run(args: readonly string[]): { errors: string[]; exitCode: number; output: string[] } {
|
|
4
|
+
const errors: string[] = [];
|
|
5
|
+
const output: string[] = [];
|
|
6
|
+
const exitCode = runRegistryTool(args, {
|
|
7
|
+
writeError: (message) => errors.push(message),
|
|
8
|
+
writeOutput: (message) => output.push(message),
|
|
9
|
+
});
|
|
10
|
+
return { errors, exitCode, output };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
describe('runRegistryTool', () => {
|
|
14
|
+
it('prints the deliberately empty built-in catalog as JSON', () => {
|
|
15
|
+
expect(run(['catalog', '--json'])).toEqual({ errors: [], exitCode: 0, output: ['[]\n'] });
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('prints help successfully', () => {
|
|
19
|
+
expect(run(['--help'])).toEqual({
|
|
20
|
+
errors: [],
|
|
21
|
+
exitCode: 0,
|
|
22
|
+
output: ['Usage: tool-registry catalog --json\n'],
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('rejects source-emission and unknown commands at the tool boundary', () => {
|
|
27
|
+
expect(run(['generate'])).toEqual({
|
|
28
|
+
errors: ['Usage: tool-registry catalog --json\n'],
|
|
29
|
+
exitCode: 1,
|
|
30
|
+
output: [],
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|