@curatelabs/graphforge-cli 0.5.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.
- package/LICENSE +202 -0
- package/NOTICE +18 -0
- package/README.md +59 -0
- package/THIRD_PARTY_NOTICES.md +9176 -0
- package/bin/graphforge.js +5 -0
- package/lib/run.mjs +51 -0
- package/package.json +56 -0
- package/project-skills/README.md +10 -0
- package/project-skills/graphforge-bootstrap/SKILL.md +31 -0
- package/project-skills/graphforge-build-knowledge/SKILL.md +37 -0
- package/project-skills/manifest.json +19 -0
package/lib/run.mjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
|
|
3
|
+
const packagedSkills = fileURLToPath(
|
|
4
|
+
new URL("../project-skills/", import.meta.url),
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Forward one invocation to the Rust-owned CLI contract.
|
|
9
|
+
*
|
|
10
|
+
* `native` is injectable for contract tests; production callers always use the
|
|
11
|
+
* public `@curatelabs/graphforge` binding.
|
|
12
|
+
*/
|
|
13
|
+
export async function run(
|
|
14
|
+
args,
|
|
15
|
+
{ stdout = process.stdout, stderr = process.stderr, native } = {},
|
|
16
|
+
) {
|
|
17
|
+
if (!Array.isArray(args) || args.some((arg) => typeof arg !== "string")) {
|
|
18
|
+
throw new TypeError("GraphForge CLI arguments must be an array of strings");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const binding = native ?? (await import("@curatelabs/graphforge"));
|
|
22
|
+
if (typeof binding.runCli !== "function") {
|
|
23
|
+
throw new TypeError(
|
|
24
|
+
"@curatelabs/graphforge does not expose the runCli contract",
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const result = await binding.runCli([
|
|
29
|
+
"--skills-bundle-dir",
|
|
30
|
+
packagedSkills,
|
|
31
|
+
...args,
|
|
32
|
+
]);
|
|
33
|
+
const exitCode = result.exitCode ?? result.exit_code;
|
|
34
|
+
if (!Number.isInteger(exitCode) || exitCode < 0 || exitCode > 255) {
|
|
35
|
+
throw new TypeError(
|
|
36
|
+
"@curatelabs/graphforge returned an invalid CLI exit code",
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
write(stdout, result.stdout);
|
|
41
|
+
write(stderr, result.stderr);
|
|
42
|
+
return exitCode;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function write(stream, value) {
|
|
46
|
+
if (value === undefined || value === null) return;
|
|
47
|
+
if (typeof value !== "string" && !ArrayBuffer.isView(value)) {
|
|
48
|
+
throw new TypeError("@curatelabs/graphforge returned invalid CLI output");
|
|
49
|
+
}
|
|
50
|
+
if (value.length > 0) stream.write(value);
|
|
51
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@curatelabs/graphforge-cli",
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "GraphForge repository lifecycle CLI",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"homepage": "https://docs.graphforge.sh/",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/CurateLabs/graphforge.git",
|
|
10
|
+
"directory": "packages/cli"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/CurateLabs/graphforge/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"graphforge",
|
|
17
|
+
"graph",
|
|
18
|
+
"knowledge-graph",
|
|
19
|
+
"cli",
|
|
20
|
+
"npx"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"bin": {
|
|
24
|
+
"graphforge": "bin/graphforge.js",
|
|
25
|
+
"gf": "bin/graphforge.js"
|
|
26
|
+
},
|
|
27
|
+
"exports": {
|
|
28
|
+
".": "./lib/run.mjs"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"bin/",
|
|
32
|
+
"lib/",
|
|
33
|
+
"project-skills/",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"NOTICE",
|
|
37
|
+
"THIRD_PARTY_NOTICES.md"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@curatelabs/graphforge": "0.5.1"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public",
|
|
47
|
+
"registry": "https://registry.npmjs.org/"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"test": "node --test tests/*.test.mjs",
|
|
51
|
+
"test:offline": "node tests/offline-pack-smoke.mjs",
|
|
52
|
+
"test:lifecycle": "node tests/native-offline-lifecycle.mjs",
|
|
53
|
+
"pack:local": "npm pack --ignore-scripts",
|
|
54
|
+
"format:check": "prettier --check package.json README.md bin lib tests"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# GraphForge project skills
|
|
2
|
+
|
|
3
|
+
This directory is the only authored source for GraphForge's project-local agent
|
|
4
|
+
skills. Distribution copies in the Python wheel and `@curatelabs/graphforge-cli` npm
|
|
5
|
+
package are generated by `scripts/sync_project_skills.py` and must remain
|
|
6
|
+
byte-identical to this directory.
|
|
7
|
+
|
|
8
|
+
The lifecycle CLI installs each skill into `.agents/skills/<skill-name>/`.
|
|
9
|
+
`manifest.json` is generated deterministically from the payload files and
|
|
10
|
+
records their compatibility and SHA-256 digests.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: graphforge-bootstrap
|
|
3
|
+
description: Initialize or inspect GraphForge repository integration without putting graph data in Git.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Bootstrap GraphForge in a repository
|
|
7
|
+
|
|
8
|
+
Use this skill when a user wants to initialize GraphForge repository support,
|
|
9
|
+
inspect its configuration, or validate the local setup.
|
|
10
|
+
|
|
11
|
+
## Procedure
|
|
12
|
+
|
|
13
|
+
1. Find the repository root and read the closest `AGENTS.md`.
|
|
14
|
+
2. Run `graphforge config validate --project-dir <root>` before changing an
|
|
15
|
+
existing setup.
|
|
16
|
+
3. For a new setup, run `graphforge init --project-dir <root>`. Do not pass
|
|
17
|
+
`--no-skills` unless the user explicitly does not want project skills.
|
|
18
|
+
4. Review `.graphforge/graphforge.yaml` and the managed `.gitignore` entries.
|
|
19
|
+
5. Run `graphforge config resolve --json --project-dir <root>` and report the
|
|
20
|
+
result without exposing secret values.
|
|
21
|
+
|
|
22
|
+
## Repository boundary
|
|
23
|
+
|
|
24
|
+
Track GraphForge definitions such as configuration, ontology, schemas,
|
|
25
|
+
migration definitions, and seed recipes. Never stage graph data, imported
|
|
26
|
+
datasets, materialized seeds, snapshots, or generated imports/exports. Runtime
|
|
27
|
+
state belongs under `.graphforge/state/`; import and export staging belongs
|
|
28
|
+
under `.graphforge/imports/` and `.graphforge/exports/`.
|
|
29
|
+
|
|
30
|
+
Reject symlinked project paths and stop if a requested operation would escape
|
|
31
|
+
the repository. Do not infer or ingest files by scanning the repository.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: graphforge-build-knowledge
|
|
3
|
+
description: Reconcile declared GraphForge definitions and external sources while preserving the Git and data boundary.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build knowledge with GraphForge
|
|
7
|
+
|
|
8
|
+
Use this skill when a user wants to synchronize declared definitions, validate
|
|
9
|
+
an infrastructure target, or move a portable GraphForge project envelope.
|
|
10
|
+
|
|
11
|
+
## Procedure
|
|
12
|
+
|
|
13
|
+
1. Read `.graphforge/graphforge.yaml` and validate it with
|
|
14
|
+
`graphforge config validate`.
|
|
15
|
+
2. Resolve configuration with `graphforge config resolve --json`; treat secret
|
|
16
|
+
references as references and never print or copy secret values.
|
|
17
|
+
3. Run `graphforge sync` only for definitions and digest-identified external
|
|
18
|
+
sources explicitly declared by the configuration. Never scan the repository
|
|
19
|
+
for data.
|
|
20
|
+
4. Before provisioning, run `graphforge infra validate --target <name>`.
|
|
21
|
+
Static validity is not service readiness.
|
|
22
|
+
5. Use `graphforge export` and `graphforge import` only for versioned portable
|
|
23
|
+
whole-project envelopes. Do not treat them as ontology-document export
|
|
24
|
+
commands. Rust-owned runtime-catalog inspection, deterministic ontology
|
|
25
|
+
suggestion, non-mutating ontology validation, and explicit YAML/JSON
|
|
26
|
+
ontology-document export belong to #236; thin Python and Node parity,
|
|
27
|
+
including durable adopt/clear behavior, belongs to #237.
|
|
28
|
+
|
|
29
|
+
## Safety
|
|
30
|
+
|
|
31
|
+
Actual graph or source data must remain outside the code repository. Never
|
|
32
|
+
stage `.graphforge/state/`, `.graphforge/imports/`, or
|
|
33
|
+
`.graphforge/exports/`. Preserve user-edited or unrelated project skills. Use a
|
|
34
|
+
checkpoint before destructive lifecycle work, and use `graphforge revert` when
|
|
35
|
+
the user requests restoration; revert publishes a new complete generation.
|
|
36
|
+
Never infer, adopt, clear, or change ontology authority as a side effect of
|
|
37
|
+
repository sync, project import/export, configuration validation, or IaC.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": 1,
|
|
3
|
+
"bundle_version": 1,
|
|
4
|
+
"graphforge_compatibility": ">=0.5.0 <0.6.0",
|
|
5
|
+
"skills": [
|
|
6
|
+
"graphforge-bootstrap",
|
|
7
|
+
"graphforge-build-knowledge"
|
|
8
|
+
],
|
|
9
|
+
"files": [
|
|
10
|
+
{
|
|
11
|
+
"path": "graphforge-bootstrap/SKILL.md",
|
|
12
|
+
"sha256": "2a5346c348f1c896483fd8d0fe90dde7db1b6b0acedfabf2554a9abd8a796542"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"path": "graphforge-build-knowledge/SKILL.md",
|
|
16
|
+
"sha256": "b53a9380a76761a0e175062c3f3d076d5139fc5cccd789d0eb52c0dd0a257d29"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|