@crewx/app 0.1.0-rc.27 → 0.1.0-rc.28
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/build-app/index.mjs +7 -618
- package/build-app/load.cjs +1 -4
- package/build-app/manifest.mjs +1 -63
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +3 -91
- package/dist/src/engine.d.ts +1 -1
- package/dist/src/engine.js +7 -1536
- package/dist/src/receipt-wait.d.ts +1 -1
- package/dist/src/receipt-wait.js +1 -41
- package/dist/src/usage.d.ts +1 -1
- package/dist/src/usage.js +8 -191
- package/package.json +2 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/src/engine.d.ts.map +0 -1
- package/dist/src/engine.js.map +0 -1
- package/dist/src/receipt-wait.d.ts.map +0 -1
- package/dist/src/receipt-wait.js.map +0 -1
- package/dist/src/usage.d.ts.map +0 -1
- package/dist/src/usage.js.map +0 -1
package/build-app/manifest.mjs
CHANGED
|
@@ -1,63 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// gets a whole manifest.json derived from the static definition in server.ts.
|
|
3
|
-
//
|
|
4
|
-
// scripts/convert-app-manifest.mjs (the repository's converter command) keeps its own copy of this
|
|
5
|
-
// mapping; packages/built-in/app/tests/build-app.test.ts compares the two on the same inputs, so a
|
|
6
|
-
// drift fails a test instead of reaching an App.
|
|
7
|
-
|
|
8
|
-
export const MCPB_MANIFEST_VERSION = '0.3';
|
|
9
|
-
export const CREWX_META_NAMESPACE = 'dev.crewx';
|
|
10
|
-
export const INITIAL_RELEASE_VERSION = '0.1.0';
|
|
11
|
-
|
|
12
|
-
// v2 fields that are not carried below `_meta["dev.crewx"]` as they are.
|
|
13
|
-
const MOVED_OUT_OF_DEV_NAMESPACE = new Set([
|
|
14
|
-
'manifestVersion',
|
|
15
|
-
'pluginId',
|
|
16
|
-
'definitionId',
|
|
17
|
-
'version',
|
|
18
|
-
'name',
|
|
19
|
-
'description',
|
|
20
|
-
'_meta',
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
function isPlainObject(value) {
|
|
24
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Maps one parsed v2 manifest to the `manifest.json` shape.
|
|
29
|
-
* Throws when the input is not a v2 manifest or cannot be represented.
|
|
30
|
-
*/
|
|
31
|
-
export function convertV2ToManifest(v2, options = {}) {
|
|
32
|
-
if (!isPlainObject(v2) || v2.manifestVersion !== 2) {
|
|
33
|
-
throw new Error('only a manifestVersion 2 ui-plugin.json can be converted');
|
|
34
|
-
}
|
|
35
|
-
for (const key of ['pluginId', 'definitionId', 'name', 'description']) {
|
|
36
|
-
if (typeof v2[key] !== 'string') throw new Error(`ui-plugin.json ${key} must be a string`);
|
|
37
|
-
}
|
|
38
|
-
if (!Number.isSafeInteger(v2.version) || v2.version < 1) {
|
|
39
|
-
throw new Error('ui-plugin.json version must be a positive integer');
|
|
40
|
-
}
|
|
41
|
-
if (v2._meta !== undefined && !isPlainObject(v2._meta)) {
|
|
42
|
-
throw new Error('ui-plugin.json _meta must be an object');
|
|
43
|
-
}
|
|
44
|
-
if (v2._meta !== undefined && Object.hasOwn(v2._meta, CREWX_META_NAMESPACE)) {
|
|
45
|
-
throw new Error(`ui-plugin.json _meta already uses the "${CREWX_META_NAMESPACE}" key`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const dev = {};
|
|
49
|
-
if (v2.definitionId !== v2.pluginId) dev.definitionId = v2.definitionId;
|
|
50
|
-
dev.definitionVersion = v2.version;
|
|
51
|
-
for (const [key, value] of Object.entries(v2)) {
|
|
52
|
-
if (!MOVED_OUT_OF_DEV_NAMESPACE.has(key)) dev[key] = value;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
manifest_version: MCPB_MANIFEST_VERSION,
|
|
57
|
-
name: v2.pluginId,
|
|
58
|
-
display_name: v2.name,
|
|
59
|
-
version: options.version ?? INITIAL_RELEASE_VERSION,
|
|
60
|
-
description: v2.description,
|
|
61
|
-
_meta: { ...(v2._meta ?? {}), [CREWX_META_NAMESPACE]: dev },
|
|
62
|
-
};
|
|
63
|
-
}
|
|
1
|
+
const a="0.3";const t="dev.crewx";const f="0.1.0";const d=new Set(["manifestVersion","pluginId","definitionId","version","name","description","_meta"]);function o(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function u(e,r={}){if(!o(e)||e.manifestVersion!==2){throw new Error("only a manifestVersion 2 ui-plugin.json can be converted")}for(const n of["pluginId","definitionId","name","description"]){if(typeof e[n]!=="string")throw new Error(`ui-plugin.json ${n} must be a string`)}if(!Number.isSafeInteger(e.version)||e.version<1){throw new Error("ui-plugin.json version must be a positive integer")}if(e._meta!==void 0&&!o(e._meta)){throw new Error("ui-plugin.json _meta must be an object")}if(e._meta!==void 0&&Object.hasOwn(e._meta,t)){throw new Error(`ui-plugin.json _meta already uses the "${t}" key`)}const i={};if(e.definitionId!==e.pluginId)i.definitionId=e.definitionId;i.definitionVersion=e.version;for(const[n,s]of Object.entries(e)){if(!d.has(n))i[n]=s}return{manifest_version:a,name:e.pluginId,display_name:e.name,version:r.version??f,description:e.description,_meta:{...e._meta??{},[t]:i}}}export{t as CREWX_META_NAMESPACE,f as INITIAL_RELEASE_VERSION,a as MCPB_MANIFEST_VERSION,u as convertV2ToManifest};
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,92 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.main = main;
|
|
38
|
-
const fs = __importStar(require("node:fs"));
|
|
39
|
-
const path = __importStar(require("node:path"));
|
|
40
|
-
const engine_js_1 = require("./src/engine.js");
|
|
41
|
-
function emitOutcome(outcome) {
|
|
42
|
-
const ticket = process.env['CREWX_TASK_TICKET'] ?? '';
|
|
43
|
-
const output = outcome.stdout
|
|
44
|
-
?? (outcome.suppressOutput ? '' : `${JSON.stringify(outcome.payload)}\n`);
|
|
45
|
-
const redactedOutput = ticket ? output.split(ticket).join('[redacted]') : output;
|
|
46
|
-
if (redactedOutput)
|
|
47
|
-
process.stdout.write(redactedOutput);
|
|
48
|
-
if (outcome.stderr) {
|
|
49
|
-
const stderr = ticket ? outcome.stderr.split(ticket).join('[redacted]') : outcome.stderr;
|
|
50
|
-
process.stderr.write(`${stderr}\n`);
|
|
51
|
-
}
|
|
52
|
-
if (outcome.exitCode !== 0)
|
|
53
|
-
process.exitCode = outcome.exitCode;
|
|
54
|
-
}
|
|
55
|
-
function printSkill() {
|
|
56
|
-
const candidates = [
|
|
57
|
-
path.join(__dirname, '..', 'SKILL.md'),
|
|
58
|
-
path.join(__dirname, 'SKILL.md'),
|
|
59
|
-
];
|
|
60
|
-
const skillPath = candidates.find((candidate) => fs.existsSync(candidate));
|
|
61
|
-
if (!skillPath)
|
|
62
|
-
throw new Error('SKILL.md is not available');
|
|
63
|
-
process.stdout.write(fs.readFileSync(skillPath, 'utf8'));
|
|
64
|
-
}
|
|
65
|
-
async function main(inputArgs) {
|
|
66
|
-
const args = inputArgs ?? process.argv.slice(2);
|
|
67
|
-
if (args[0] === 'usage' && args.length === 1) {
|
|
68
|
-
try {
|
|
69
|
-
printSkill();
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
emitOutcome({
|
|
73
|
-
exitCode: 1,
|
|
74
|
-
payload: { ok: false, exit: 1, error: { code: 'ERROR', status: null } },
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
emitOutcome(await (0, engine_js_1.executeAppCommand)(args));
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
emitOutcome({
|
|
84
|
-
exitCode: 1,
|
|
85
|
-
payload: { ok: false, exit: 1, error: { code: 'ERROR', status: null } },
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (require.main === module) {
|
|
90
|
-
void main();
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=cli.js.map
|
|
2
|
+
"use strict";var d=exports&&exports.__createBinding||(Object.create?(function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}):(function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]}));var f=exports&&exports.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}):function(t,e){t["default"]=e});var a=exports&&exports.__importStar||(function(){var t=function(e){t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i))n[n.length]=i;return n};return t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var n=t(e),i=0;i<n.length;i++)if(n[i]!=="default")d(r,e,n[i])}f(r,e);return r}})();Object.defineProperty(exports,"__esModule",{value:true});exports.main=o;const u=a(require("node:fs"));const c=a(require("node:path"));const l=require("./src/engine.js");function s(t){const e=process.env["CREWX_TASK_TICKET"]??"";const r=t.stdout??(t.suppressOutput?"":`${JSON.stringify(t.payload)}
|
|
3
|
+
`);const n=e?r.split(e).join("[redacted]"):r;if(n)process.stdout.write(n);if(t.stderr){const i=e?t.stderr.split(e).join("[redacted]"):t.stderr;process.stderr.write(`${i}
|
|
4
|
+
`)}if(t.exitCode!==0)process.exitCode=t.exitCode}function _(){const t=[c.join(__dirname,"..","SKILL.md"),c.join(__dirname,"SKILL.md")];const e=t.find(r=>u.existsSync(r));if(!e)throw new Error("SKILL.md is not available");process.stdout.write(u.readFileSync(e,"utf8"))}async function o(t){const e=t??process.argv.slice(2);if(e[0]==="usage"&&e.length===1){try{_()}catch{s({exitCode:1,payload:{ok:false,exit:1,error:{code:"ERROR",status:null}}})}return}try{s(await(0,l.executeAppCommand)(e))}catch{s({exitCode:1,payload:{ok:false,exit:1,error:{code:"ERROR",status:null}}})}}if(require.main===module){void o()}
|
package/dist/src/engine.d.ts
CHANGED