camstack 1.2.177 → 1.2.179
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/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
FFMPEG_PATH_ENV,
|
|
4
4
|
runDiscover
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MRRNUEHP.js";
|
|
6
6
|
import "./chunk-LMMQX4CK.js";
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
@@ -10,7 +10,7 @@ import { createRequire } from "module";
|
|
|
10
10
|
import { fileURLToPath } from "url";
|
|
11
11
|
import { dirname, resolve as resolve5 } from "path";
|
|
12
12
|
import * as os5 from "os";
|
|
13
|
-
import { parseArgs as
|
|
13
|
+
import { parseArgs as parseArgs8 } from "util";
|
|
14
14
|
|
|
15
15
|
// src/commands/serve.ts
|
|
16
16
|
import { parseArgs } from "util";
|
|
@@ -39,7 +39,7 @@ async function runServe(args) {
|
|
|
39
39
|
...typeof values.data === "string" ? { data: values.data } : {}
|
|
40
40
|
};
|
|
41
41
|
Object.assign(process.env, buildServeEnv(opts));
|
|
42
|
-
await import("./launcher-
|
|
42
|
+
await import("./launcher-ER4ORH3G.js");
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// src/commands/agent.ts
|
|
@@ -72,7 +72,7 @@ async function runAgent(args) {
|
|
|
72
72
|
allowPositionals: false
|
|
73
73
|
});
|
|
74
74
|
if (typeof values.hub !== "string" || values.hub.length === 0) {
|
|
75
|
-
throw new Error("--hub is required (e.g. --hub 192.168.
|
|
75
|
+
throw new Error("--hub is required (e.g. --hub 192.168.10.10)");
|
|
76
76
|
}
|
|
77
77
|
if (typeof values.token !== "string" || values.token.length === 0) {
|
|
78
78
|
throw new Error("--token is required");
|
|
@@ -84,7 +84,7 @@ async function runAgent(args) {
|
|
|
84
84
|
...typeof values.port === "string" ? { port: values.port } : {}
|
|
85
85
|
};
|
|
86
86
|
Object.assign(process.env, buildAgentEnv(opts));
|
|
87
|
-
await import("./launcher-
|
|
87
|
+
await import("./launcher-ER4ORH3G.js");
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// src/commands/setup.ts
|
|
@@ -1134,7 +1134,7 @@ function isUnknown(_value) {
|
|
|
1134
1134
|
return true;
|
|
1135
1135
|
}
|
|
1136
1136
|
async function resolveServerInteractive(presetNamespace) {
|
|
1137
|
-
const { discoverNodes, resolveHubFromDiscovered, filterHubNodes, DEFAULT_HUB_HTTPS_PORT } = await import("./discover-
|
|
1137
|
+
const { discoverNodes, resolveHubFromDiscovered, filterHubNodes, DEFAULT_HUB_HTTPS_PORT } = await import("./discover-TGPXHMVK.js");
|
|
1138
1138
|
if (presetNamespace) {
|
|
1139
1139
|
const spinner4 = clack.spinner();
|
|
1140
1140
|
spinner4.start(`Discovering hub on LAN (namespace "${presetNamespace}")`);
|
|
@@ -1844,6 +1844,340 @@ async function runWatch(args) {
|
|
|
1844
1844
|
}
|
|
1845
1845
|
}
|
|
1846
1846
|
|
|
1847
|
+
// src/commands/develop.ts
|
|
1848
|
+
import { parseArgs as parseArgs7 } from "util";
|
|
1849
|
+
import {
|
|
1850
|
+
extendAddon,
|
|
1851
|
+
findExample,
|
|
1852
|
+
findWorkspaceRoot,
|
|
1853
|
+
getCapability,
|
|
1854
|
+
listAddonPackages,
|
|
1855
|
+
listCapabilities,
|
|
1856
|
+
listExamples,
|
|
1857
|
+
listSkills,
|
|
1858
|
+
readSkill,
|
|
1859
|
+
requireWorkspaceRoot,
|
|
1860
|
+
scaffoldAddon,
|
|
1861
|
+
scaffoldCapStub,
|
|
1862
|
+
validateAddon,
|
|
1863
|
+
whoProvides
|
|
1864
|
+
} from "@camstack/develop";
|
|
1865
|
+
var HELP = `Usage: camstack develop <subcommand> [options]
|
|
1866
|
+
|
|
1867
|
+
Catalogue:
|
|
1868
|
+
list-addons [--json] List workspace packages with camstack.addons[]
|
|
1869
|
+
list-caps [--json] List *.cap.ts capability names
|
|
1870
|
+
who-provides <cap> [--json] Which addons declare a capability
|
|
1871
|
+
find-example <query> [--json] Ranked core-package examples
|
|
1872
|
+
examples [--json] Full curated example catalogue
|
|
1873
|
+
|
|
1874
|
+
Scaffold / extend:
|
|
1875
|
+
scaffold addon <name> [options] New packages/addon-<name>/
|
|
1876
|
+
--display-name <str>
|
|
1877
|
+
--description <str>
|
|
1878
|
+
--kind empty|provider|notifier|osd|post-analysis
|
|
1879
|
+
--directory <dir> Default: packages
|
|
1880
|
+
--dry-run
|
|
1881
|
+
scaffold cap <name> [options] Stub packages/types/.../<name>.cap.ts
|
|
1882
|
+
--scope system|device
|
|
1883
|
+
--mode singleton|collection
|
|
1884
|
+
--dry-run
|
|
1885
|
+
extend <addon> --entry <id> New manifest entry in an existing package
|
|
1886
|
+
--display-name <str>
|
|
1887
|
+
--description <str>
|
|
1888
|
+
--dry-run
|
|
1889
|
+
|
|
1890
|
+
Validate:
|
|
1891
|
+
validate [addon|--all] [--json] Manifest + vite entries (+ known caps)
|
|
1892
|
+
|
|
1893
|
+
Skills:
|
|
1894
|
+
skills [--json] Paths to the portable skill pack
|
|
1895
|
+
skill <id> Print one skill markdown file
|
|
1896
|
+
|
|
1897
|
+
Also: nx g @camstack/nx-plugin:addon <name> (Nx path to the same idea).
|
|
1898
|
+
`;
|
|
1899
|
+
function printJson(value) {
|
|
1900
|
+
console.log(JSON.stringify(value, null, 2));
|
|
1901
|
+
}
|
|
1902
|
+
function wantJson(args) {
|
|
1903
|
+
return args.includes("--json");
|
|
1904
|
+
}
|
|
1905
|
+
function withoutJson(args) {
|
|
1906
|
+
return args.filter((a) => a !== "--json");
|
|
1907
|
+
}
|
|
1908
|
+
function developHelp() {
|
|
1909
|
+
return HELP;
|
|
1910
|
+
}
|
|
1911
|
+
async function runDevelop(args) {
|
|
1912
|
+
if (args.length === 0 || args[0] === "-h" || args[0] === "--help") {
|
|
1913
|
+
console.log(HELP);
|
|
1914
|
+
return;
|
|
1915
|
+
}
|
|
1916
|
+
const sub = args[0] ?? "";
|
|
1917
|
+
const rest = args.slice(1);
|
|
1918
|
+
switch (sub) {
|
|
1919
|
+
case "list-addons":
|
|
1920
|
+
return cmdListAddons(rest);
|
|
1921
|
+
case "list-caps":
|
|
1922
|
+
return cmdListCaps(rest);
|
|
1923
|
+
case "who-provides":
|
|
1924
|
+
return cmdWhoProvides(rest);
|
|
1925
|
+
case "find-example":
|
|
1926
|
+
return cmdFindExample(rest);
|
|
1927
|
+
case "examples":
|
|
1928
|
+
return cmdExamples(rest);
|
|
1929
|
+
case "scaffold":
|
|
1930
|
+
return cmdScaffold(rest);
|
|
1931
|
+
case "extend":
|
|
1932
|
+
return cmdExtend(rest);
|
|
1933
|
+
case "validate":
|
|
1934
|
+
return cmdValidate(rest);
|
|
1935
|
+
case "skills":
|
|
1936
|
+
return cmdSkills(rest);
|
|
1937
|
+
case "skill":
|
|
1938
|
+
return cmdSkill(rest);
|
|
1939
|
+
default:
|
|
1940
|
+
throw new Error(`Unknown develop subcommand: ${sub}
|
|
1941
|
+
|
|
1942
|
+
${HELP}`);
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
function cmdListAddons(args) {
|
|
1946
|
+
const root = requireWorkspaceRoot();
|
|
1947
|
+
const pkgs = listAddonPackages(root);
|
|
1948
|
+
if (wantJson(args)) {
|
|
1949
|
+
printJson(pkgs);
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
for (const pkg of pkgs) {
|
|
1953
|
+
const ids = pkg.addons.map((a) => a.id).join(", ");
|
|
1954
|
+
console.log(`${pkg.packageName} ${pkg.relativeDir} [${ids}]`);
|
|
1955
|
+
}
|
|
1956
|
+
console.log(`
|
|
1957
|
+
${pkgs.length} package(s)`);
|
|
1958
|
+
}
|
|
1959
|
+
function cmdListCaps(args) {
|
|
1960
|
+
const root = requireWorkspaceRoot();
|
|
1961
|
+
const caps = listCapabilities(root);
|
|
1962
|
+
if (wantJson(args)) {
|
|
1963
|
+
printJson(caps);
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
for (const cap of caps) {
|
|
1967
|
+
const meta = [cap.scope, cap.mode].filter(Boolean).join("/");
|
|
1968
|
+
console.log(`${cap.name} ${meta} ${cap.relativeFile}`);
|
|
1969
|
+
}
|
|
1970
|
+
console.log(`
|
|
1971
|
+
${caps.length} capability(ies)`);
|
|
1972
|
+
}
|
|
1973
|
+
function cmdWhoProvides(args) {
|
|
1974
|
+
const json = wantJson(args);
|
|
1975
|
+
const cleaned = withoutJson(args);
|
|
1976
|
+
const cap = cleaned[0];
|
|
1977
|
+
if (!cap) throw new Error("Usage: camstack develop who-provides <cap>");
|
|
1978
|
+
const root = requireWorkspaceRoot();
|
|
1979
|
+
const hits = whoProvides(root, cap);
|
|
1980
|
+
if (json) {
|
|
1981
|
+
printJson(hits);
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
if (hits.length === 0) {
|
|
1985
|
+
console.log(`No addon declares capability \`${cap}\`.`);
|
|
1986
|
+
return;
|
|
1987
|
+
}
|
|
1988
|
+
for (const hit of hits) {
|
|
1989
|
+
console.log(`${hit.package.packageName} ${hit.addon.id} ${hit.package.relativeDir}`);
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
function cmdFindExample(args) {
|
|
1993
|
+
const json = wantJson(args);
|
|
1994
|
+
const cleaned = withoutJson(args);
|
|
1995
|
+
const query = cleaned.join(" ").trim();
|
|
1996
|
+
if (!query) throw new Error("Usage: camstack develop find-example <query>");
|
|
1997
|
+
const root = findWorkspaceRoot() ?? process.cwd();
|
|
1998
|
+
const hits = findExample(root, query);
|
|
1999
|
+
if (json) {
|
|
2000
|
+
printJson(hits);
|
|
2001
|
+
return;
|
|
2002
|
+
}
|
|
2003
|
+
if (hits.length === 0) {
|
|
2004
|
+
console.log("No examples matched.");
|
|
2005
|
+
return;
|
|
2006
|
+
}
|
|
2007
|
+
for (const hit of hits.slice(0, 10)) {
|
|
2008
|
+
console.log(
|
|
2009
|
+
`[${hit.score}] ${hit.example.id} ${hit.example.packageDir}
|
|
2010
|
+
${hit.example.demonstrates}
|
|
2011
|
+
(${hit.rationale})`
|
|
2012
|
+
);
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
function cmdExamples(args) {
|
|
2016
|
+
const examples = listExamples();
|
|
2017
|
+
if (wantJson(args)) {
|
|
2018
|
+
printJson(examples);
|
|
2019
|
+
return;
|
|
2020
|
+
}
|
|
2021
|
+
for (const ex of examples) {
|
|
2022
|
+
console.log(`${ex.id} ${ex.kind} ${ex.packageDir}
|
|
2023
|
+
${ex.demonstrates}`);
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
function cmdScaffold(args) {
|
|
2027
|
+
const kind = args[0];
|
|
2028
|
+
if (kind === "addon") return cmdScaffoldAddon(args.slice(1));
|
|
2029
|
+
if (kind === "cap" || kind === "capability") return cmdScaffoldCap(args.slice(1));
|
|
2030
|
+
throw new Error("Usage: camstack develop scaffold addon|cap <name> [options]");
|
|
2031
|
+
}
|
|
2032
|
+
function cmdScaffoldAddon(args) {
|
|
2033
|
+
const { values, positionals } = parseArgs7({
|
|
2034
|
+
args: [...args],
|
|
2035
|
+
options: {
|
|
2036
|
+
"display-name": { type: "string" },
|
|
2037
|
+
description: { type: "string" },
|
|
2038
|
+
kind: { type: "string" },
|
|
2039
|
+
directory: { type: "string" },
|
|
2040
|
+
"dry-run": { type: "boolean" }
|
|
2041
|
+
},
|
|
2042
|
+
allowPositionals: true,
|
|
2043
|
+
strict: true
|
|
2044
|
+
});
|
|
2045
|
+
const name = positionals[0];
|
|
2046
|
+
if (!name) throw new Error("Usage: camstack develop scaffold addon <name>");
|
|
2047
|
+
const kindRaw = typeof values.kind === "string" ? values.kind : "empty";
|
|
2048
|
+
const allowed = /* @__PURE__ */ new Set(["empty", "provider", "notifier", "osd", "post-analysis"]);
|
|
2049
|
+
if (!allowed.has(kindRaw)) {
|
|
2050
|
+
throw new Error(`--kind must be one of: ${[...allowed].join(", ")}`);
|
|
2051
|
+
}
|
|
2052
|
+
const root = requireWorkspaceRoot();
|
|
2053
|
+
const result = scaffoldAddon({
|
|
2054
|
+
workspaceRoot: root,
|
|
2055
|
+
name,
|
|
2056
|
+
...typeof values["display-name"] === "string" ? { displayName: values["display-name"] } : {},
|
|
2057
|
+
...typeof values.description === "string" ? { description: values.description } : {},
|
|
2058
|
+
kind: kindRaw,
|
|
2059
|
+
...typeof values.directory === "string" ? { directory: values.directory } : {},
|
|
2060
|
+
dryRun: values["dry-run"] === true
|
|
2061
|
+
});
|
|
2062
|
+
console.log(
|
|
2063
|
+
values["dry-run"] === true ? `[dry-run] would create ${result.relativeDir}` : `Created ${result.relativeDir}`
|
|
2064
|
+
);
|
|
2065
|
+
for (const f of result.filesWritten) console.log(` + ${f}`);
|
|
2066
|
+
console.log("\nNext:");
|
|
2067
|
+
for (const step of result.nextSteps) console.log(` - ${step}`);
|
|
2068
|
+
}
|
|
2069
|
+
function cmdScaffoldCap(args) {
|
|
2070
|
+
const { values, positionals } = parseArgs7({
|
|
2071
|
+
args: [...args],
|
|
2072
|
+
options: {
|
|
2073
|
+
scope: { type: "string" },
|
|
2074
|
+
mode: { type: "string" },
|
|
2075
|
+
"dry-run": { type: "boolean" }
|
|
2076
|
+
},
|
|
2077
|
+
allowPositionals: true,
|
|
2078
|
+
strict: true
|
|
2079
|
+
});
|
|
2080
|
+
const name = positionals[0];
|
|
2081
|
+
if (!name) throw new Error("Usage: camstack develop scaffold cap <name>");
|
|
2082
|
+
const scope = typeof values.scope === "string" ? values.scope : "system";
|
|
2083
|
+
const mode = typeof values.mode === "string" ? values.mode : "singleton";
|
|
2084
|
+
if (scope !== "system" && scope !== "device") {
|
|
2085
|
+
throw new Error("--scope must be system or device");
|
|
2086
|
+
}
|
|
2087
|
+
if (mode !== "singleton" && mode !== "collection") {
|
|
2088
|
+
throw new Error("--mode must be singleton or collection");
|
|
2089
|
+
}
|
|
2090
|
+
const root = requireWorkspaceRoot();
|
|
2091
|
+
const result = scaffoldCapStub({
|
|
2092
|
+
workspaceRoot: root,
|
|
2093
|
+
name,
|
|
2094
|
+
scope,
|
|
2095
|
+
mode,
|
|
2096
|
+
dryRun: values["dry-run"] === true
|
|
2097
|
+
});
|
|
2098
|
+
console.log(
|
|
2099
|
+
values["dry-run"] === true ? `[dry-run] would write ${result.relativePath}` : `Wrote ${result.relativePath} (${result.exportName})`
|
|
2100
|
+
);
|
|
2101
|
+
console.log("\nNext:");
|
|
2102
|
+
for (const step of result.nextSteps) console.log(` - ${step}`);
|
|
2103
|
+
}
|
|
2104
|
+
function cmdExtend(args) {
|
|
2105
|
+
const { values, positionals } = parseArgs7({
|
|
2106
|
+
args: [...args],
|
|
2107
|
+
options: {
|
|
2108
|
+
entry: { type: "string" },
|
|
2109
|
+
"display-name": { type: "string" },
|
|
2110
|
+
description: { type: "string" },
|
|
2111
|
+
"dry-run": { type: "boolean" }
|
|
2112
|
+
},
|
|
2113
|
+
allowPositionals: true,
|
|
2114
|
+
strict: true
|
|
2115
|
+
});
|
|
2116
|
+
const addon = positionals[0];
|
|
2117
|
+
const entry = typeof values.entry === "string" ? values.entry : void 0;
|
|
2118
|
+
if (!addon || !entry) {
|
|
2119
|
+
throw new Error("Usage: camstack develop extend <addon> --entry <id>");
|
|
2120
|
+
}
|
|
2121
|
+
const root = requireWorkspaceRoot();
|
|
2122
|
+
const result = extendAddon({
|
|
2123
|
+
workspaceRoot: root,
|
|
2124
|
+
addon,
|
|
2125
|
+
entryId: entry,
|
|
2126
|
+
...typeof values["display-name"] === "string" ? { displayName: values["display-name"] } : {},
|
|
2127
|
+
...typeof values.description === "string" ? { description: values.description } : {},
|
|
2128
|
+
dryRun: values["dry-run"] === true
|
|
2129
|
+
});
|
|
2130
|
+
console.log(
|
|
2131
|
+
values["dry-run"] === true ? `[dry-run] would extend ${result.packageDir} with ${result.entryId}` : `Extended ${result.packageDir} with entry ${result.entryId}`
|
|
2132
|
+
);
|
|
2133
|
+
for (const f of result.filesWritten) console.log(` ~ ${f}`);
|
|
2134
|
+
console.log("\nNext:");
|
|
2135
|
+
for (const step of result.nextSteps) console.log(` - ${step}`);
|
|
2136
|
+
}
|
|
2137
|
+
function cmdValidate(args) {
|
|
2138
|
+
const json = wantJson(args);
|
|
2139
|
+
const cleaned = withoutJson(args);
|
|
2140
|
+
const query = cleaned[0];
|
|
2141
|
+
const root = requireWorkspaceRoot();
|
|
2142
|
+
const result = validateAddon(root, query);
|
|
2143
|
+
if (json) {
|
|
2144
|
+
printJson(result);
|
|
2145
|
+
} else {
|
|
2146
|
+
if (result.findings.length === 0) {
|
|
2147
|
+
console.log("\u2714 no findings");
|
|
2148
|
+
} else {
|
|
2149
|
+
for (const f of result.findings) {
|
|
2150
|
+
const mark = f.level === "error" ? "\u2718" : f.level === "warn" ? "!" : "\xB7";
|
|
2151
|
+
console.log(`${mark} [${f.code}] ${f.message}`);
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
console.log(result.ok ? "\n\u2714 validate ok" : "\n\u2718 validate failed");
|
|
2155
|
+
}
|
|
2156
|
+
if (!result.ok) process.exitCode = 1;
|
|
2157
|
+
}
|
|
2158
|
+
function cmdSkills(args) {
|
|
2159
|
+
const skills = listSkills();
|
|
2160
|
+
if (wantJson(args)) {
|
|
2161
|
+
printJson(skills);
|
|
2162
|
+
return;
|
|
2163
|
+
}
|
|
2164
|
+
console.log("Portable skill pack (@camstack/develop/skills):\n");
|
|
2165
|
+
for (const s of skills) {
|
|
2166
|
+
console.log(`${s.id} ${s.title}
|
|
2167
|
+
${s.absolutePath}`);
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
function cmdSkill(args) {
|
|
2171
|
+
const id = args[0];
|
|
2172
|
+
if (!id) throw new Error("Usage: camstack develop skill <id>");
|
|
2173
|
+
const skill = readSkill(id);
|
|
2174
|
+
if (!skill) {
|
|
2175
|
+
const known = listSkills().map((s) => s.id).join(", ");
|
|
2176
|
+
throw new Error(`Unknown skill: ${id}. Known: ${known}`);
|
|
2177
|
+
}
|
|
2178
|
+
console.log(skill.content);
|
|
2179
|
+
}
|
|
2180
|
+
|
|
1847
2181
|
// src/cli.ts
|
|
1848
2182
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1849
2183
|
var require2 = createRequire(import.meta.url);
|
|
@@ -2078,6 +2412,13 @@ function buildCommands() {
|
|
|
2078
2412
|
"a push are coalesced into the next cycle."
|
|
2079
2413
|
].join("\n")
|
|
2080
2414
|
},
|
|
2415
|
+
{
|
|
2416
|
+
name: "develop",
|
|
2417
|
+
aliases: ["addon"],
|
|
2418
|
+
summary: "Authoring tools \u2014 catalogue, scaffold, validate, find-example, skills (same ops as MCP)",
|
|
2419
|
+
run: runDevelop,
|
|
2420
|
+
help: developHelp
|
|
2421
|
+
},
|
|
2081
2422
|
{
|
|
2082
2423
|
name: "update",
|
|
2083
2424
|
aliases: ["upgrade"],
|
|
@@ -2111,7 +2452,7 @@ function buildCommands() {
|
|
|
2111
2452
|
}
|
|
2112
2453
|
function parseSubcommandArgs(args, options, allowPositionals) {
|
|
2113
2454
|
if (args.some((a) => HELP_FLAGS.has(a))) return null;
|
|
2114
|
-
const parsed =
|
|
2455
|
+
const parsed = parseArgs8({
|
|
2115
2456
|
args: [...args],
|
|
2116
2457
|
options,
|
|
2117
2458
|
allowPositionals,
|