@aionis/manifest 0.1.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/CHANGELOG.md +26 -0
- package/LICENSE +178 -0
- package/README.md +170 -0
- package/dist/ast/types.d.ts +34 -0
- package/dist/ast/types.js +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +122 -0
- package/dist/compile.d.ts +14 -0
- package/dist/compile.js +219 -0
- package/dist/contracts.d.ts +12610 -0
- package/dist/contracts.js +401 -0
- package/dist/diagnostics/types.d.ts +17 -0
- package/dist/diagnostics/types.js +1 -0
- package/dist/execute/localRuntime.d.ts +5 -0
- package/dist/execute/localRuntime.js +165 -0
- package/dist/execute/moduleRuntime.d.ts +25 -0
- package/dist/execute/moduleRuntime.js +352 -0
- package/dist/execute/types.d.ts +113 -0
- package/dist/execute/types.js +1 -0
- package/dist/execute-cli.d.ts +2 -0
- package/dist/execute-cli.js +112 -0
- package/dist/execute.d.ts +6 -0
- package/dist/execute.js +46 -0
- package/dist/graph/buildExecutionGraph.d.ts +8 -0
- package/dist/graph/buildExecutionGraph.js +69 -0
- package/dist/graph/types.d.ts +24 -0
- package/dist/graph/types.js +1 -0
- package/dist/handoff-store-cli.d.ts +2 -0
- package/dist/handoff-store-cli.js +139 -0
- package/dist/handoff-store.d.ts +103 -0
- package/dist/handoff-store.js +78 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +21 -0
- package/dist/ir/types.d.ts +92 -0
- package/dist/ir/types.js +1 -0
- package/dist/parser/parseAst.d.ts +3 -0
- package/dist/parser/parseAst.js +207 -0
- package/dist/parser/payload.d.ts +6 -0
- package/dist/parser/payload.js +211 -0
- package/dist/plan/buildExecutionPlan.d.ts +9 -0
- package/dist/plan/buildExecutionPlan.js +98 -0
- package/dist/plan/types.d.ts +44 -0
- package/dist/plan/types.js +1 -0
- package/dist/publish-cli.d.ts +2 -0
- package/dist/publish-cli.js +249 -0
- package/dist/publish.d.ts +148 -0
- package/dist/publish.js +190 -0
- package/dist/recover-cli.d.ts +2 -0
- package/dist/recover-cli.js +258 -0
- package/dist/recover.d.ts +489 -0
- package/dist/recover.js +290 -0
- package/dist/refs/resolveRefs.d.ts +13 -0
- package/dist/refs/resolveRefs.js +104 -0
- package/dist/registry/loadModuleRegistry.d.ts +28 -0
- package/dist/registry/loadModuleRegistry.js +97 -0
- package/dist/registry/types.d.ts +20 -0
- package/dist/registry/types.js +2 -0
- package/dist/resume-cli.d.ts +2 -0
- package/dist/resume-cli.js +379 -0
- package/dist/resume.d.ts +2076 -0
- package/dist/resume.js +452 -0
- package/dist/run-cli.d.ts +2 -0
- package/dist/run-cli.js +119 -0
- package/dist/run.d.ts +9 -0
- package/dist/run.js +43 -0
- package/dist/runtime-handoff-cli.d.ts +2 -0
- package/dist/runtime-handoff-cli.js +179 -0
- package/dist/runtime-handoff.d.ts +914 -0
- package/dist/runtime-handoff.js +383 -0
- package/dist/scanner/scanSource.d.ts +9 -0
- package/dist/scanner/scanSource.js +43 -0
- package/dist/schema/validateIrSchemas.d.ts +3 -0
- package/dist/schema/validateIrSchemas.js +64 -0
- package/dist/validate-module-cli.d.ts +2 -0
- package/dist/validate-module-cli.js +93 -0
- package/dist/validate-registry-cli.d.ts +2 -0
- package/dist/validate-registry-cli.js +82 -0
- package/dist/validate.d.ts +52 -0
- package/dist/validate.js +91 -0
- package/fixtures/duplicate-doc.aionis.md +19 -0
- package/fixtures/fenced-example.aionis.md +27 -0
- package/fixtures/malformed-payload.aionis.md +9 -0
- package/fixtures/npm-installed-module-registry.json +17 -0
- package/fixtures/standalone-module-registry.json +13 -0
- package/fixtures/standalone-runner-plan.json +51 -0
- package/fixtures/standalone-runner.aionis.md +29 -0
- package/fixtures/unresolved-ref.aionis.md +14 -0
- package/fixtures/valid-minimal.aionis.md +24 -0
- package/fixtures/valid-workflow.aionis.md +29 -0
- package/official-modules/copy-summary/CHANGELOG.md +6 -0
- package/official-modules/copy-summary/README.md +43 -0
- package/official-modules/copy-summary/index.mjs +41 -0
- package/official-modules/copy-summary/package.json +31 -0
- package/official-modules/json-transform/CHANGELOG.md +6 -0
- package/official-modules/json-transform/README.md +51 -0
- package/official-modules/json-transform/index.mjs +53 -0
- package/official-modules/json-transform/package.json +31 -0
- package/official-modules/research-claims/CHANGELOG.md +6 -0
- package/official-modules/research-claims/README.md +47 -0
- package/official-modules/research-claims/index.mjs +44 -0
- package/official-modules/research-claims/package.json +31 -0
- package/package.json +74 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { compileAionisManifest } from "./compile.js";
|
|
6
|
+
import { buildRuntimeHandoffV1, buildRuntimeHandoffV1FromEnvelope, } from "./runtime-handoff.js";
|
|
7
|
+
class CliUsageError extends Error {
|
|
8
|
+
}
|
|
9
|
+
function printHelp() {
|
|
10
|
+
process.stdout.write([
|
|
11
|
+
"build-aionis-manifest-runtime-handoff",
|
|
12
|
+
"",
|
|
13
|
+
"Usage:",
|
|
14
|
+
" build-aionis-manifest-runtime-handoff <input-file> [--input-kind source|compile-envelope] [--scope <scope>] [--out <path>]",
|
|
15
|
+
" [--repo-root <path>] [--file-path <path>] [--symbol <name>]",
|
|
16
|
+
" [--current-stage triage|patch|review|resume] [--active-role orchestrator|triage|patch|review|resume]",
|
|
17
|
+
" [--allow-compile-errors] [--compact]",
|
|
18
|
+
"",
|
|
19
|
+
"Notes:",
|
|
20
|
+
" source mode compiles an AionisManifest source file before building the runtime handoff.",
|
|
21
|
+
" compile-envelope mode reads JSON produced by compile-aionis-manifest and derives the runtime handoff from it.",
|
|
22
|
+
"",
|
|
23
|
+
].join("\n"));
|
|
24
|
+
}
|
|
25
|
+
function parseArgs(argv) {
|
|
26
|
+
let inputPath = null;
|
|
27
|
+
const flags = {
|
|
28
|
+
inputKind: "source",
|
|
29
|
+
scope: null,
|
|
30
|
+
out: null,
|
|
31
|
+
compact: false,
|
|
32
|
+
help: false,
|
|
33
|
+
allowCompileErrors: false,
|
|
34
|
+
repoRoot: null,
|
|
35
|
+
filePath: null,
|
|
36
|
+
symbol: null,
|
|
37
|
+
currentStage: null,
|
|
38
|
+
activeRole: null,
|
|
39
|
+
};
|
|
40
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
41
|
+
const token = argv[i];
|
|
42
|
+
if (token === "--help" || token === "-h") {
|
|
43
|
+
flags.help = true;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (token === "--compact") {
|
|
47
|
+
flags.compact = true;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (token === "--allow-compile-errors") {
|
|
51
|
+
flags.allowCompileErrors = true;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (token === "--input-kind" ||
|
|
55
|
+
token === "--scope" ||
|
|
56
|
+
token === "--out" ||
|
|
57
|
+
token === "--repo-root" ||
|
|
58
|
+
token === "--file-path" ||
|
|
59
|
+
token === "--symbol" ||
|
|
60
|
+
token === "--current-stage" ||
|
|
61
|
+
token === "--active-role") {
|
|
62
|
+
const value = argv[i + 1];
|
|
63
|
+
if (!value)
|
|
64
|
+
throw new CliUsageError(`Missing value for ${token}.`);
|
|
65
|
+
switch (token) {
|
|
66
|
+
case "--input-kind":
|
|
67
|
+
if (value !== "source" && value !== "compile-envelope") {
|
|
68
|
+
throw new CliUsageError(`Unsupported input kind '${value}'.`);
|
|
69
|
+
}
|
|
70
|
+
flags.inputKind = value;
|
|
71
|
+
break;
|
|
72
|
+
case "--scope":
|
|
73
|
+
flags.scope = value;
|
|
74
|
+
break;
|
|
75
|
+
case "--out":
|
|
76
|
+
flags.out = value;
|
|
77
|
+
break;
|
|
78
|
+
case "--repo-root":
|
|
79
|
+
flags.repoRoot = value;
|
|
80
|
+
break;
|
|
81
|
+
case "--file-path":
|
|
82
|
+
flags.filePath = value;
|
|
83
|
+
break;
|
|
84
|
+
case "--symbol":
|
|
85
|
+
flags.symbol = value;
|
|
86
|
+
break;
|
|
87
|
+
case "--current-stage":
|
|
88
|
+
if (!["triage", "patch", "review", "resume"].includes(value)) {
|
|
89
|
+
throw new CliUsageError(`Unsupported current stage '${value}'.`);
|
|
90
|
+
}
|
|
91
|
+
flags.currentStage = value;
|
|
92
|
+
break;
|
|
93
|
+
case "--active-role":
|
|
94
|
+
if (!["orchestrator", "triage", "patch", "review", "resume"].includes(value)) {
|
|
95
|
+
throw new CliUsageError(`Unsupported active role '${value}'.`);
|
|
96
|
+
}
|
|
97
|
+
flags.activeRole = value;
|
|
98
|
+
break;
|
|
99
|
+
default:
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
i += 1;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (token.startsWith("--")) {
|
|
106
|
+
throw new CliUsageError(`Unknown flag '${token}'.`);
|
|
107
|
+
}
|
|
108
|
+
if (inputPath) {
|
|
109
|
+
throw new CliUsageError("Only one input file may be provided.");
|
|
110
|
+
}
|
|
111
|
+
inputPath = token;
|
|
112
|
+
}
|
|
113
|
+
return { inputPath, flags };
|
|
114
|
+
}
|
|
115
|
+
async function writeOutput(pathname, contents) {
|
|
116
|
+
await mkdir(dirname(pathname), { recursive: true });
|
|
117
|
+
await writeFile(pathname, contents, "utf8");
|
|
118
|
+
}
|
|
119
|
+
async function loadJson(pathname) {
|
|
120
|
+
return JSON.parse(await readFile(pathname, "utf8"));
|
|
121
|
+
}
|
|
122
|
+
async function buildFromInput(inputPath, flags) {
|
|
123
|
+
if (flags.inputKind === "compile-envelope") {
|
|
124
|
+
const envelope = await loadJson(inputPath);
|
|
125
|
+
return buildRuntimeHandoffV1FromEnvelope({
|
|
126
|
+
envelope,
|
|
127
|
+
scope: flags.scope ?? undefined,
|
|
128
|
+
repoRoot: flags.repoRoot,
|
|
129
|
+
filePath: flags.filePath,
|
|
130
|
+
symbol: flags.symbol,
|
|
131
|
+
currentStage: flags.currentStage ?? undefined,
|
|
132
|
+
activeRole: flags.activeRole ?? undefined,
|
|
133
|
+
requireErrorFree: !flags.allowCompileErrors,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
const source = await readFile(inputPath, "utf8");
|
|
137
|
+
const result = compileAionisManifest(source);
|
|
138
|
+
return buildRuntimeHandoffV1({
|
|
139
|
+
inputPath,
|
|
140
|
+
result,
|
|
141
|
+
scope: flags.scope ?? undefined,
|
|
142
|
+
repoRoot: flags.repoRoot,
|
|
143
|
+
filePath: flags.filePath,
|
|
144
|
+
symbol: flags.symbol,
|
|
145
|
+
currentStage: flags.currentStage ?? undefined,
|
|
146
|
+
activeRole: flags.activeRole ?? undefined,
|
|
147
|
+
requireErrorFree: !flags.allowCompileErrors,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
async function main() {
|
|
151
|
+
const { inputPath, flags } = parseArgs(process.argv.slice(2));
|
|
152
|
+
if (flags.help) {
|
|
153
|
+
printHelp();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (!inputPath) {
|
|
157
|
+
throw new CliUsageError("An input file path is required.");
|
|
158
|
+
}
|
|
159
|
+
const resolvedInput = resolve(process.cwd(), inputPath);
|
|
160
|
+
const handoff = await buildFromInput(resolvedInput, flags);
|
|
161
|
+
const rendered = flags.compact ? JSON.stringify(handoff) : `${JSON.stringify(handoff, null, 2)}\n`;
|
|
162
|
+
if (flags.out) {
|
|
163
|
+
await writeOutput(resolve(process.cwd(), flags.out), rendered);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
process.stdout.write(rendered);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
main().catch((error) => {
|
|
170
|
+
if (error instanceof CliUsageError) {
|
|
171
|
+
process.stderr.write(`${error.message}\n`);
|
|
172
|
+
printHelp();
|
|
173
|
+
process.exitCode = 2;
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
177
|
+
process.stderr.write(`${message}\n`);
|
|
178
|
+
process.exitCode = 1;
|
|
179
|
+
});
|