toolfactory 0.1.1 → 0.2.0
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/README.md +31 -3
- package/dist/bindings/python.js +1 -1
- package/dist/commands.d.ts +1 -1
- package/dist/distribution/native.d.ts +50 -0
- package/dist/distribution/native.js +414 -0
- package/dist/distribution/native.test.d.ts +1 -0
- package/dist/distribution/native.test.js +127 -0
- package/dist/distribution/system.d.ts +57 -0
- package/dist/distribution/system.js +637 -0
- package/dist/distribution/system.test.d.ts +1 -0
- package/dist/distribution/system.test.js +116 -0
- package/dist/e2e.test.js +7 -1
- package/dist/hosts/openclaw.js +6 -2
- package/dist/hosts/vscode.d.ts +1 -0
- package/dist/hosts/vscode.js +67 -0
- package/dist/model.d.ts +63 -2
- package/dist/model.js +18 -1
- package/dist/ops.d.ts +52 -0
- package/dist/project/apply.d.ts +1 -1
- package/dist/project/apply.js +194 -17
- package/dist/project/apply.test.js +103 -0
- package/dist/project/gate.d.ts +17 -2
- package/dist/project/gate.js +102 -23
- package/dist/project/history.d.ts +30 -1
- package/dist/project/lock.d.ts +5 -0
- package/dist/project/lock.js +9 -0
- package/dist/surfaces/agent-plugins.js +5 -4
- package/dist/surfaces/agents.js +27 -3
- package/dist/surfaces/agents.test.js +12 -0
- package/dist/surfaces/claude.js +8 -3
- package/dist/surfaces/codex.js +9 -4
- package/dist/surfaces/codex.test.js +16 -6
- package/dist/surfaces/cursor.js +2 -2
- package/dist/surfaces/distribution.test.js +121 -7
- package/dist/surfaces/dsh.js +29 -7
- package/dist/surfaces/dsh.test.js +11 -6
- package/dist/surfaces/gemini.js +2 -2
- package/dist/surfaces/gemini.test.js +4 -4
- package/dist/surfaces/hermes-native.js +43 -12
- package/dist/surfaces/hermes-native.test.js +53 -11
- package/dist/surfaces/mcp-registry.js +59 -7
- package/dist/surfaces/mcp-registry.test.js +23 -0
- package/dist/surfaces/mcpb.d.ts +1 -0
- package/dist/surfaces/mcpb.js +36 -23
- package/dist/surfaces/mcpb.test.js +31 -3
- package/dist/surfaces/npm.js +45 -14
- package/dist/surfaces/openclaw-native.js +10 -8
- package/dist/surfaces/openclaw-native.test.js +30 -0
- package/dist/surfaces/pypi.js +27 -3
- package/dist/surfaces/readme.d.ts +16 -0
- package/dist/surfaces/readme.js +17 -7
- package/dist/surfaces/registry.js +9 -3
- package/dist/surfaces/vscode-extension.d.ts +14 -0
- package/dist/surfaces/vscode-extension.js +312 -0
- package/dist/surfaces/vscode-extension.test.d.ts +1 -0
- package/dist/surfaces/vscode-extension.test.js +81 -0
- package/dist/surfaces/vscode-scaffold.d.ts +43 -0
- package/dist/surfaces/vscode-scaffold.js +43 -0
- package/dist/surfaces/workflows.js +57 -11
- package/dist/surfaces/workflows.test.js +71 -3
- package/dist/toolfactory/cli.js +1 -1
- package/dist/toolfactory/mcp.js +1 -1
- package/package.json +2 -1
- package/src/bindings/python.ts +1 -1
- package/src/distribution/native.test.ts +161 -0
- package/src/distribution/native.ts +460 -0
- package/src/distribution/system.test.ts +136 -0
- package/src/distribution/system.ts +688 -0
- package/src/e2e.test.ts +7 -1
- package/src/hosts/openclaw.ts +4 -2
- package/src/hosts/vscode.ts +79 -0
- package/src/model.ts +26 -2
- package/src/project/apply.test.ts +120 -0
- package/src/project/apply.ts +257 -15
- package/src/project/gate.ts +131 -24
- package/src/project/lock.ts +12 -0
- package/src/surfaces/agent-plugins.ts +5 -4
- package/src/surfaces/agents.test.ts +16 -0
- package/src/surfaces/agents.ts +38 -3
- package/src/surfaces/claude.ts +7 -3
- package/src/surfaces/codex.test.ts +15 -5
- package/src/surfaces/codex.ts +12 -6
- package/src/surfaces/cursor.ts +2 -10
- package/src/surfaces/distribution.test.ts +141 -6
- package/src/surfaces/dsh.test.ts +11 -5
- package/src/surfaces/dsh.ts +30 -7
- package/src/surfaces/gemini.test.ts +3 -3
- package/src/surfaces/gemini.ts +1 -2
- package/src/surfaces/hermes-native.test.ts +61 -10
- package/src/surfaces/hermes-native.ts +46 -13
- package/src/surfaces/mcp-registry.test.ts +28 -0
- package/src/surfaces/mcp-registry.ts +66 -8
- package/src/surfaces/mcpb.test.ts +32 -5
- package/src/surfaces/mcpb.ts +44 -23
- package/src/surfaces/npm.ts +47 -15
- package/src/surfaces/openclaw-native.test.ts +37 -0
- package/src/surfaces/openclaw-native.ts +49 -47
- package/src/surfaces/pypi.ts +27 -3
- package/src/surfaces/readme.ts +21 -6
- package/src/surfaces/registry.ts +9 -3
- package/src/surfaces/vscode-extension.test.ts +89 -0
- package/src/surfaces/vscode-extension.ts +345 -0
- package/src/surfaces/vscode-scaffold.ts +55 -0
- package/src/surfaces/workflows.test.ts +86 -3
- package/src/surfaces/workflows.ts +57 -11
- package/src/toolfactory/cli.ts +1 -1
- package/src/toolfactory/mcp.ts +1 -1
- package/web/dist/assets/{index-CCXhQKK3.css → index-BuT2czb2.css} +1 -1
- package/web/dist/assets/{index-D1PwZ3qS.js → index-CVm6m4s0.js} +1 -1
- package/web/dist/index.html +2 -2
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { nativeInstallLines, nativePackageConfigSchema, nativePackageSteps, nativePublishJobs, nativeRegistryRows, } from "./native.js";
|
|
3
|
+
function project(entries, surfaces = entries.map((entry) => entry.id)) {
|
|
4
|
+
return {
|
|
5
|
+
root: "/repo",
|
|
6
|
+
tool: {
|
|
7
|
+
schemaVersion: 1,
|
|
8
|
+
identity: "package.json",
|
|
9
|
+
binding: "typescript",
|
|
10
|
+
surfaces: surfaces,
|
|
11
|
+
bundle: { runtime: "package" },
|
|
12
|
+
tests: { examples: {} },
|
|
13
|
+
nativePackages: entries,
|
|
14
|
+
},
|
|
15
|
+
identity: { name: "tool", version: "1.2.3", repository: "https://github.com/acme/tool" },
|
|
16
|
+
identityExtra: {},
|
|
17
|
+
operations: [],
|
|
18
|
+
toolfactoryVersion: "0.1.0",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const cargo = {
|
|
22
|
+
id: "cargo",
|
|
23
|
+
path: "native/cli",
|
|
24
|
+
identity: "Cargo.toml",
|
|
25
|
+
name: "acme-cli",
|
|
26
|
+
versionCommand: "cargo pkgid | sed 's/.*@//'",
|
|
27
|
+
};
|
|
28
|
+
describe("native package configuration", () => {
|
|
29
|
+
it("requires the package path, authored identity, and registry identity", () => {
|
|
30
|
+
expect(() => nativePackageConfigSchema.parse({ id: "cargo", path: "native" })).toThrow();
|
|
31
|
+
expect(nativePackageConfigSchema.parse(cargo)).toEqual(cargo);
|
|
32
|
+
});
|
|
33
|
+
it("rejects a selected registry with no config or duplicate configuration", () => {
|
|
34
|
+
expect(() => nativePackageSteps(project([], ["cargo"]))).toThrow(/requires exactly one/);
|
|
35
|
+
expect(() => nativePackageSteps(project([cargo, cargo]))).toThrow(/repeats/);
|
|
36
|
+
});
|
|
37
|
+
it("packages authored crates and checks their version against the release", () => {
|
|
38
|
+
const steps = nativePackageSteps(project([cargo]));
|
|
39
|
+
expect(steps.map((step) => step.name)).toEqual([
|
|
40
|
+
"cargo version matches release",
|
|
41
|
+
"Cargo crate",
|
|
42
|
+
]);
|
|
43
|
+
expect(steps[0]?.run).toContain("= '1.2.3'");
|
|
44
|
+
expect(steps[1]?.run).toContain("cargo package --manifest-path 'native/cli/Cargo.toml'");
|
|
45
|
+
expect(steps[1]?.run).toContain("--target-dir 'dist/native-build/cargo'");
|
|
46
|
+
expect(steps[1]?.run).not.toContain("/repo");
|
|
47
|
+
});
|
|
48
|
+
it("reads structured Cargo metadata and the raw MSBuild version", () => {
|
|
49
|
+
const cargoDefault = {
|
|
50
|
+
id: "cargo",
|
|
51
|
+
path: "native/cli",
|
|
52
|
+
identity: "Cargo.toml",
|
|
53
|
+
name: "acme-cli",
|
|
54
|
+
};
|
|
55
|
+
const nuget = {
|
|
56
|
+
id: "nuget",
|
|
57
|
+
path: "dotnet",
|
|
58
|
+
identity: "Tool.csproj",
|
|
59
|
+
name: "Acme.Tool",
|
|
60
|
+
};
|
|
61
|
+
const steps = nativePackageSteps(project([cargoDefault, nuget]));
|
|
62
|
+
expect(steps[0]?.run).toContain("cargo metadata --no-deps --format-version 1 --manifest-path 'Cargo.toml'");
|
|
63
|
+
expect(steps[0]?.run).toContain("JSON.parse(s).packages.find");
|
|
64
|
+
expect(steps[2]?.run).toContain("dotnet msbuild 'Tool.csproj' -nologo -getProperty:Version");
|
|
65
|
+
expect(steps[2]?.run).not.toContain("sed -n");
|
|
66
|
+
});
|
|
67
|
+
it("leaves VCS-discovered Packagist and Go modules for the final release tag", () => {
|
|
68
|
+
const entries = [
|
|
69
|
+
{
|
|
70
|
+
id: "packagist",
|
|
71
|
+
path: ".",
|
|
72
|
+
identity: "composer.json",
|
|
73
|
+
name: "acme/tool",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "go-module",
|
|
77
|
+
path: ".",
|
|
78
|
+
identity: "go.mod",
|
|
79
|
+
name: "github.com/acme/tool",
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
expect(nativePackageSteps(project(entries))).toEqual([]);
|
|
83
|
+
expect(nativeInstallLines(project(entries))).toEqual([
|
|
84
|
+
"`composer require acme/tool`",
|
|
85
|
+
"`go get github.com/acme/tool@v1.2.3`",
|
|
86
|
+
]);
|
|
87
|
+
});
|
|
88
|
+
it("uses direct upstream publishing commands and exposes only their actual credentials", () => {
|
|
89
|
+
const entries = [
|
|
90
|
+
cargo,
|
|
91
|
+
{
|
|
92
|
+
id: "nuget",
|
|
93
|
+
path: "dotnet",
|
|
94
|
+
identity: "Tool.csproj",
|
|
95
|
+
name: "Acme.Tool",
|
|
96
|
+
versionCommand: "dotnet msbuild -getProperty:Version Tool.csproj",
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
const jobs = nativePublishJobs(project(entries), "release-assets", "${{ needs.gate.outputs.sha }}");
|
|
100
|
+
expect(jobs["publish-cargo"]?.steps).toContainEqual(expect.objectContaining({ run: expect.stringContaining("cargo publish") }));
|
|
101
|
+
expect(jobs["publish-nuget"]?.steps).toContainEqual(expect.objectContaining({ run: expect.stringContaining("dotnet nuget push") }));
|
|
102
|
+
expect(jobs["publish-nuget"]?.steps).toContainEqual(expect.objectContaining({
|
|
103
|
+
uses: "actions/setup-dotnet@v5",
|
|
104
|
+
with: { "dotnet-version": "8.0.x" },
|
|
105
|
+
}));
|
|
106
|
+
expect(nativeRegistryRows(project(entries)).map((row) => row.secrets)).toEqual([
|
|
107
|
+
["CARGO_REGISTRY_TOKEN"],
|
|
108
|
+
["NUGET_API_KEY"],
|
|
109
|
+
]);
|
|
110
|
+
expect(jobs["publish-cargo"]?.needs).toEqual(["gate", "package"]);
|
|
111
|
+
expect(jobs["publish-cargo"]?.if).toBe("needs.gate.outputs.cargo == 'true'");
|
|
112
|
+
expect(jobs["publish-cargo"]?.steps).not.toContainEqual(expect.objectContaining({ uses: "dtolnay/rust-toolchain@stable" }));
|
|
113
|
+
});
|
|
114
|
+
it("builds a gem from its package directory before moving the resulting asset", () => {
|
|
115
|
+
const steps = nativePackageSteps(project([
|
|
116
|
+
{
|
|
117
|
+
id: "rubygems",
|
|
118
|
+
path: "native/ruby",
|
|
119
|
+
identity: "acme.gemspec",
|
|
120
|
+
name: "acme",
|
|
121
|
+
versionCommand: "ruby -e 'puts 1.2.3'",
|
|
122
|
+
},
|
|
123
|
+
]));
|
|
124
|
+
expect(steps[1]?.run).toContain("(cd 'native/ruby' && gem build --strict 'acme.gemspec')");
|
|
125
|
+
expect(steps[1]?.run).toContain("mv 'native/ruby/acme-1.2.3.gem'");
|
|
126
|
+
});
|
|
127
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operating-system package managers consume authored native artifacts and packaging metadata.
|
|
3
|
+
* This is intentionally not a cross-language compiler or a launcher generator.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import type { Project, Surface } from "../model.js";
|
|
7
|
+
import type { GateStep, Registry } from "../project/gate.js";
|
|
8
|
+
export declare const SYSTEM_PACKAGE_IDS: readonly ["homebrew", "winget", "scoop", "chocolatey", "apt", "rpm"];
|
|
9
|
+
export type SystemPackageId = (typeof SYSTEM_PACKAGE_IDS)[number];
|
|
10
|
+
export declare const systemPackageConfigSchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodEnum<{
|
|
12
|
+
homebrew: "homebrew";
|
|
13
|
+
winget: "winget";
|
|
14
|
+
scoop: "scoop";
|
|
15
|
+
chocolatey: "chocolatey";
|
|
16
|
+
apt: "apt";
|
|
17
|
+
rpm: "rpm";
|
|
18
|
+
}>;
|
|
19
|
+
path: z.ZodString;
|
|
20
|
+
identity: z.ZodString;
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
versionCommand: z.ZodString;
|
|
23
|
+
buildCommand: z.ZodOptional<z.ZodString>;
|
|
24
|
+
buildDependencies: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
25
|
+
asset: z.ZodOptional<z.ZodString>;
|
|
26
|
+
tap: z.ZodOptional<z.ZodString>;
|
|
27
|
+
bucket: z.ZodOptional<z.ZodString>;
|
|
28
|
+
bucketName: z.ZodOptional<z.ZodString>;
|
|
29
|
+
catalogPath: z.ZodOptional<z.ZodString>;
|
|
30
|
+
ppa: z.ZodOptional<z.ZodString>;
|
|
31
|
+
coprProject: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export type SystemPackageConfig = z.infer<typeof systemPackageConfigSchema>;
|
|
34
|
+
export declare const systemPackageSurfaces: Surface[];
|
|
35
|
+
/** Required CLI preflight for compatible local runs; native CI jobs install their own tooling. */
|
|
36
|
+
export declare function systemToolchainSteps(project: Project, options?: {
|
|
37
|
+
include?: boolean;
|
|
38
|
+
}): GateStep[];
|
|
39
|
+
/** Build actual package artifacts or stage the authored catalog submission, all at portable paths. */
|
|
40
|
+
export declare function systemPackageSteps(project: Project, options?: {
|
|
41
|
+
include?: boolean;
|
|
42
|
+
local?: boolean;
|
|
43
|
+
}): GateStep[];
|
|
44
|
+
export declare function systemRegistryRows(project: Project): Registry[];
|
|
45
|
+
type Job = Record<string, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* Native runner jobs. The generic Ubuntu gate/package workflow must not execute OS surface steps;
|
|
48
|
+
* it waits for these jobs and downloads each `system-<id>` artifact into dist/release/system/<id>.
|
|
49
|
+
*/
|
|
50
|
+
export declare function systemPackageJobs(project: Project, releaseSha: string): Record<string, Job>;
|
|
51
|
+
/**
|
|
52
|
+
* Publish only after the GitHub release exists. Homebrew taps and Scoop buckets are ordinary
|
|
53
|
+
* author-controlled Git repositories; WinGet remains a reviewed microsoft/winget-pkgs submission.
|
|
54
|
+
*/
|
|
55
|
+
export declare function systemPublishJobs(project: Project, artifactDir: string, _releaseSha: string): Record<string, Job>;
|
|
56
|
+
export declare function systemInstallLines(project: Project): string[];
|
|
57
|
+
export {};
|