agentwheel 0.3.0 → 0.3.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 (3) hide show
  1. package/README.md +28 -0
  2. package/dist/index.js +41 -22
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -102,6 +102,34 @@ A package is a git repo (or folder) with a JSON manifest and a canonical layout:
102
102
  Publish by pushing to any git host. A registry exists only for short names and discovery — it's
103
103
  optional, and `agentwheel add <url|path>` always works without it.
104
104
 
105
+ ## How to add a package
106
+
107
+ The public package registry lives at
108
+ [`NestDevLab/agentwheel-registry`](https://github.com/NestDevLab/agentwheel-registry).
109
+
110
+ 1. Create a public repo with `agentwheel.json` and a standard layout such as `instructions/`, `rules/`, `skills/`, `commands/`, `mcp/`, or `hooks/`.
111
+ 2. Open a pull request to `agentwheel-registry` that adds an entry to `index.json`.
112
+ 3. Users install by short name:
113
+
114
+ ```bash
115
+ agentwheel registry update
116
+ agentwheel add your-package-name --adapter openclaw
117
+ agentwheel update --dry-run
118
+ agentwheel update
119
+ ```
120
+
121
+ Example registry entry:
122
+
123
+ ```json
124
+ {
125
+ "name": "your-package-name",
126
+ "source": "github:your-org/your-agent-package",
127
+ "type": "package",
128
+ "description": "Reusable skills, rules, and instructions for agentwheel.",
129
+ "tags": ["skills", "rules", "instructions"]
130
+ }
131
+ ```
132
+
105
133
  ## Customizing without getting overwritten
106
134
 
107
135
  Drift detection blocks *accidental* edits to generated files. *Intentional* changes have four channels,
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
 
10
10
  // src/cli/index.ts
11
11
  import { mkdir as mkdir7, rm as rm8, writeFile as writeFile4 } from "fs/promises";
12
- import { join as join17 } from "path";
12
+ import { join as join18 } from "path";
13
13
  import { Command } from "commander";
14
14
 
15
15
  // src/adapters/resolve.ts
@@ -1882,6 +1882,23 @@ async function packageFromSource(source, options) {
1882
1882
  };
1883
1883
  }
1884
1884
 
1885
+ // src/lifecycle/source-plan.ts
1886
+ import { join as join17 } from "path";
1887
+ async function createSourcePlan(options) {
1888
+ const resolvedInput = await resolvePackageSource(options.source, options.targetRoot);
1889
+ const resolvedSource = resolvedInput.source;
1890
+ const driver = getSourceDriver(options.driver ?? inferSourceDriverName(resolvedSource));
1891
+ const bundle = await stageSource(driver, resolvedSource, {
1892
+ workspaceRoot: options.targetRoot,
1893
+ adapter: options.adapter,
1894
+ cacheRoot: join17(options.targetRoot, ".agentwheel", "cache"),
1895
+ mode: options.mode
1896
+ });
1897
+ const manifest = await readInstallManifest(options.targetRoot, options.adapter.name);
1898
+ const plan = await createInstallPlan(bundle, options.adapter, options.targetRoot, manifest);
1899
+ return { plan, bundle, resolvedSource, registryEntryName: resolvedInput.registryEntry?.name };
1900
+ }
1901
+
1885
1902
  // src/lifecycle/update.ts
1886
1903
  function shouldUpdatePackage(pkg, lock) {
1887
1904
  if (!lock) {
@@ -1901,7 +1918,7 @@ function shouldUpdatePackage(pkg, lock) {
1901
1918
 
1902
1919
  // src/cli/index.ts
1903
1920
  var program = new Command();
1904
- program.name("agentwheel").description("Multi-runtime agent artifact orchestrator").version("0.2.0");
1921
+ program.name("agentwheel").description("Multi-runtime agent artifact orchestrator").version("0.3.1");
1905
1922
  program.command("init").argument("[kind]", "workspace or package", "workspace").option("--target-root <path>", "workspace root", process.cwd()).action(async (kind, options) => {
1906
1923
  const root = normalizeTargetRoot(options.targetRoot);
1907
1924
  if (kind === "package") {
@@ -1932,7 +1949,7 @@ program.command("add").argument("<source>", "package source").option("--driver <
1932
1949
  const bundle = await stageSource(driver, resolvedSource, {
1933
1950
  workspaceRoot: targetRoot,
1934
1951
  adapter,
1935
- cacheRoot: join17(targetRoot, ".agentwheel", "cache"),
1952
+ cacheRoot: join18(targetRoot, ".agentwheel", "cache"),
1936
1953
  mode: options.mode
1937
1954
  });
1938
1955
  const name = options.name ?? resolvedInput.registryEntry?.name ?? bundle.source.packageName ?? source;
@@ -1951,17 +1968,21 @@ program.command("add").argument("<source>", "package source").option("--driver <
1951
1968
  await rm8(bundle.root, { recursive: true, force: true });
1952
1969
  console.log(`Added ${name}.`);
1953
1970
  });
1954
- program.command("list").argument("<source>", "local source directory").option("--driver <driver>", "source driver").action(async (source, options) => {
1955
- const driver = getSourceDriver(options.driver ?? inferSourceDriverName(source));
1956
- const resolved = await driver.resolve(source);
1971
+ program.command("list").argument("<source>", "package source").option("--driver <driver>", "source driver").option("--target-root <path>", "workspace root", process.cwd()).action(async (source, options) => {
1972
+ const targetRoot = normalizeTargetRoot(options.targetRoot);
1973
+ const resolvedInput = await resolvePackageSource(source, targetRoot);
1974
+ const driver = getSourceDriver(options.driver ?? inferSourceDriverName(resolvedInput.source));
1975
+ const resolved = await driver.export(await driver.translate(await driver.fetch(await driver.resolve(resolvedInput.source, { cacheRoot: join18(targetRoot, ".agentwheel", "cache") }))));
1957
1976
  const artifacts = await driver.list(resolved);
1958
1977
  for (const artifact of artifacts) {
1959
1978
  console.log(`${artifact.type} ${artifact.name} ${artifact.relativePath}`);
1960
1979
  }
1961
1980
  });
1962
- program.command("scan").argument("<source>", "local source directory").option("--driver <driver>", "source driver").action(async (source, options) => {
1963
- const driver = getSourceDriver(options.driver ?? inferSourceDriverName(source));
1964
- const resolved = await driver.resolve(source);
1981
+ program.command("scan").argument("<source>", "package source").option("--driver <driver>", "source driver").option("--target-root <path>", "workspace root", process.cwd()).action(async (source, options) => {
1982
+ const targetRoot = normalizeTargetRoot(options.targetRoot);
1983
+ const resolvedInput = await resolvePackageSource(source, targetRoot);
1984
+ const driver = getSourceDriver(options.driver ?? inferSourceDriverName(resolvedInput.source));
1985
+ const resolved = await driver.export(await driver.translate(await driver.fetch(await driver.resolve(resolvedInput.source, { cacheRoot: join18(targetRoot, ".agentwheel", "cache") }))));
1965
1986
  const result = await driver.scan(resolved);
1966
1987
  if (result.findings.length === 0) {
1967
1988
  console.log("Scan ok: no findings");
@@ -1972,7 +1993,7 @@ program.command("scan").argument("<source>", "local source directory").option("-
1972
1993
  }
1973
1994
  if (!result.ok) process.exitCode = 1;
1974
1995
  });
1975
- program.command("plan").argument("<source>", "source directory").option("--driver <driver>", "source driver").option("--adapter <adapter>", "built-in adapter", "openclaw").option("--adapter-config <path>", "adapter JSON/JSONC file").option("--adapter-module <path>", "local programmatic adapter module").option("--allow-adapter-code", "allow loading local adapter code", false).option("--target-root <path>", "runtime/project root", process.cwd()).option("--mode <mode>", "pinned or tracking").action(async (source, options) => {
1996
+ program.command("plan").argument("<source>", "source directory").option("--driver <driver>", "source driver").option("--adapter <adapter>", "built-in adapter", "openclaw").option("--adapter-config <path>", "adapter JSON/JSONC file").option("--adapter-module <path>", "local programmatic adapter module").option("--allow-adapter-code", "allow loading local adapter code", false).option("--target-root <path>", "runtime/project root", process.cwd()).option("--mode <mode>", "pinned or tracking").option("--dry-run", "accepted for symmetry; plan never writes", false).action(async (source, options) => {
1976
1997
  const { plan, bundle } = await buildPlan(source, options);
1977
1998
  console.log(formatPlan(plan));
1978
1999
  await rm8(bundle.root, { recursive: true, force: true });
@@ -2105,7 +2126,6 @@ program.command("uninstall").option("--adapter <adapter>", "adapter", "openclaw"
2105
2126
  if (plan.hasBlockingChanges) process.exitCode = 1;
2106
2127
  });
2107
2128
  async function buildPlan(source, options) {
2108
- const driver = getSourceDriver(options.driver ?? inferSourceDriverName(source));
2109
2129
  const targetRoot = normalizeTargetRoot(options.targetRoot);
2110
2130
  const adapter = await resolveAdapter({
2111
2131
  adapter: options.adapter,
@@ -2115,21 +2135,20 @@ async function buildPlan(source, options) {
2115
2135
  baseDir: targetRoot,
2116
2136
  warn: (message) => console.warn(message)
2117
2137
  });
2118
- const bundle = await stageSource(driver, source, {
2119
- workspaceRoot: targetRoot,
2138
+ const result = await createSourcePlan({
2139
+ source,
2140
+ targetRoot,
2120
2141
  adapter,
2121
- cacheRoot: join17(targetRoot, ".agentwheel", "cache"),
2142
+ driver: options.driver,
2122
2143
  mode: options.mode
2123
2144
  });
2124
- const manifest = await readInstallManifest(targetRoot, adapter.name);
2125
- const plan = await createInstallPlan(bundle, adapter, targetRoot, manifest);
2126
- return { plan, bundle };
2145
+ return { plan: result.plan, bundle: result.bundle };
2127
2146
  }
2128
2147
  async function initPackage(root) {
2129
- await mkdir7(join17(root, "instructions"), { recursive: true });
2130
- await mkdir7(join17(root, "rules"), { recursive: true });
2131
- await mkdir7(join17(root, "skills"), { recursive: true });
2132
- const manifestPath = join17(root, "agentwheel.json");
2148
+ await mkdir7(join18(root, "instructions"), { recursive: true });
2149
+ await mkdir7(join18(root, "rules"), { recursive: true });
2150
+ await mkdir7(join18(root, "skills"), { recursive: true });
2151
+ const manifestPath = join18(root, "agentwheel.json");
2133
2152
  const manifest = {
2134
2153
  schemaVersion: 1,
2135
2154
  name: "example/agentwheel-package",
@@ -2142,7 +2161,7 @@ async function initPackage(root) {
2142
2161
  };
2143
2162
  await writeFile4(manifestPath, `${JSON.stringify(manifest, null, 2)}
2144
2163
  `, "utf8");
2145
- await writeFile4(join17(root, "instructions", "AGENTS.md"), "# Agent Instructions\n", "utf8");
2164
+ await writeFile4(join18(root, "instructions", "AGENTS.md"), "# Agent Instructions\n", "utf8");
2146
2165
  }
2147
2166
  function printRegistryEntries(entries) {
2148
2167
  for (const entry of entries) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentwheel",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Weave skills, rules, and instructions across every AI agent.",
5
5
  "type": "module",
6
6
  "license": "MIT",