@onetaskgraph/sdk 0.2.1

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.
Files changed (2) hide show
  1. package/README.md +31 -0
  2. package/package.json +39 -0
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # @onetaskgraph/sdk
2
+
3
+ The TypeScript SDK for [onetaskgraph](https://github.com/nickderobertis/onetaskgraph).
4
+
5
+ It drives the real `onetaskgraph` binary as a subprocess and parses the machine-readable
6
+ output against the schema bundle that binary emits (`onetaskgraph schema`). The engine is
7
+ reused rather than reimplemented, so the CLI, a script and an application cannot answer the
8
+ same question differently.
9
+
10
+ Create a client and call the typed method matching the CLI command:
11
+
12
+ ```ts
13
+ import { OnetaskgraphClient } from "@onetaskgraph/sdk";
14
+
15
+ const client = new OnetaskgraphClient();
16
+ const response = await client.taskList({ labels: ["bug"] });
17
+ ```
18
+
19
+ The executable is resolved in this order: the constructor's explicit `binaryPath`, the
20
+ `ONETASKGRAPH_BIN` environment variable, then the executable supplied by the packaged
21
+ `@onetaskgraph/cli` dependency. If that dependency cannot be resolved, the client uses
22
+ `onetaskgraph` from `PATH`.
23
+
24
+ Every invocation requests JSON. The SDK parses stdout and validates it against runtime
25
+ schemas generated from `onetaskgraph schema` before returning it. Query responses retain
26
+ their `plan` and typed `errors`; exit code 4 therefore resolves to the validated partial
27
+ response instead of discarding the successful sources.
28
+
29
+ Run `bun run --cwd sdks/typescript generate` after changing the binary contract. The gate's
30
+ `./scripts/nx.sh run sdk-typescript:generate-check` target builds the binary and then fails
31
+ naming any generated file that would change.
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@onetaskgraph/sdk",
3
+ "version": "0.2.1",
4
+ "description": "The TypeScript SDK for onetaskgraph, generated from the binary's own JSON Schema bundle.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/nickderobertis/onetaskgraph.git",
18
+ "directory": "sdks/typescript"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md"
23
+ ],
24
+ "scripts": {
25
+ "build": "bun build src/index.ts --outdir dist --target node && bun run tsc -p tsconfig.build.json",
26
+ "generate": "bun scripts/generate.ts",
27
+ "generate:check": "bun scripts/generate.ts --check"
28
+ },
29
+ "optionalDependencies": {
30
+ "@onetaskgraph/cli": "0.2.1"
31
+ },
32
+ "devDependencies": {
33
+ "ajv": "8.17.1",
34
+ "json-schema-to-typescript": "15.0.4"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ }
39
+ }