hadara 0.1.0-rc.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/LICENSE +21 -0
- package/README.md +109 -0
- package/dist/agent/evidence.js +50 -0
- package/dist/agent/loop.js +124 -0
- package/dist/cli/args.js +70 -0
- package/dist/cli/dashboard.js +185 -0
- package/dist/cli/debt.js +41 -0
- package/dist/cli/doctor.js +68 -0
- package/dist/cli/errors.js +58 -0
- package/dist/cli/evidence-json.js +75 -0
- package/dist/cli/evidence.js +80 -0
- package/dist/cli/handoff.js +16 -0
- package/dist/cli/harness.js +57 -0
- package/dist/cli/hermes-json.js +31 -0
- package/dist/cli/hermes.js +28 -0
- package/dist/cli/init.js +142 -0
- package/dist/cli/install.js +34 -0
- package/dist/cli/main.js +216 -0
- package/dist/cli/mcp.js +15 -0
- package/dist/cli/package-smoke.js +37 -0
- package/dist/cli/policy-json.js +22 -0
- package/dist/cli/policy.js +43 -0
- package/dist/cli/release-artifact.js +47 -0
- package/dist/cli/release-dry-run.js +24 -0
- package/dist/cli/release-gate.js +28 -0
- package/dist/cli/release-publish.js +41 -0
- package/dist/cli/run-scaffold.js +68 -0
- package/dist/cli/run-state.js +41 -0
- package/dist/cli/run.js +191 -0
- package/dist/cli/smoke.js +58 -0
- package/dist/cli/status-json.js +6 -0
- package/dist/cli/status.js +26 -0
- package/dist/cli/task-json.js +8 -0
- package/dist/cli/task.js +64 -0
- package/dist/cli/tools.js +25 -0
- package/dist/cli/tui.js +72 -0
- package/dist/cli/write-preflight.js +27 -0
- package/dist/core/audit.js +41 -0
- package/dist/core/events.js +63 -0
- package/dist/core/fs.js +44 -0
- package/dist/core/paths.js +59 -0
- package/dist/core/redaction.js +178 -0
- package/dist/core/schema.js +253 -0
- package/dist/core/workspace.js +47 -0
- package/dist/evidence/evidence.js +170 -0
- package/dist/evidence/private-manifest.js +101 -0
- package/dist/handoff/handoff.js +49 -0
- package/dist/harness/replay.js +200 -0
- package/dist/harness/validate.js +465 -0
- package/dist/hermes/context-export.js +104 -0
- package/dist/index.js +29 -0
- package/dist/mcp/server.js +104 -0
- package/dist/mcp/tool-dispatch.js +159 -0
- package/dist/mcp/tool-registry.js +150 -0
- package/dist/mcp/tool-schemas.js +18 -0
- package/dist/policy/command-risk.js +39 -0
- package/dist/policy/permission-matrix.js +42 -0
- package/dist/policy/policy.js +20 -0
- package/dist/policy/preflight.js +47 -0
- package/dist/policy/presets.js +24 -0
- package/dist/policy/tokenizer.js +53 -0
- package/dist/providers/fallback-executor.js +46 -0
- package/dist/providers/mock-provider.js +49 -0
- package/dist/providers/provider-contract.js +2 -0
- package/dist/providers/provider-preparation.js +220 -0
- package/dist/providers/scripted-provider.js +69 -0
- package/dist/schemas/active-run-projection.schema.json +73 -0
- package/dist/schemas/active-run-resume.schema.json +68 -0
- package/dist/schemas/clean-checkout-smoke.schema.json +126 -0
- package/dist/schemas/context-export.schema.json +35 -0
- package/dist/schemas/event.schema.json +17 -0
- package/dist/schemas/evidence-list.schema.json +49 -0
- package/dist/schemas/feature-smoke.schema.json +67 -0
- package/dist/schemas/install-plan.schema.json +93 -0
- package/dist/schemas/package-smoke.schema.json +130 -0
- package/dist/schemas/private-evidence.schema.json +48 -0
- package/dist/schemas/provider-call.schema.json +42 -0
- package/dist/schemas/provider-config.schema.json +43 -0
- package/dist/schemas/release-artifact-manifest.schema.json +55 -0
- package/dist/schemas/release-artifact.schema.json +140 -0
- package/dist/schemas/release-dry-run.schema.json +141 -0
- package/dist/schemas/release-gate.schema.json +42 -0
- package/dist/schemas/release-publish.schema.json +114 -0
- package/dist/schemas/schema-index.json +145 -0
- package/dist/schemas/smoke-evidence-summary.schema.json +88 -0
- package/dist/schemas/tools-list.schema.json +78 -0
- package/dist/schemas/write-preflight.schema.json +47 -0
- package/dist/services/active-run-state.js +215 -0
- package/dist/services/capability-registry.js +540 -0
- package/dist/services/clean-checkout-smoke.js +393 -0
- package/dist/services/evidence-list.js +136 -0
- package/dist/services/feature-smoke.js +155 -0
- package/dist/services/harness-service.js +7 -0
- package/dist/services/install-plan.js +233 -0
- package/dist/services/operational-debt.js +767 -0
- package/dist/services/operations-status-service.js +195 -0
- package/dist/services/package-smoke.js +676 -0
- package/dist/services/policy-service.js +25 -0
- package/dist/services/project-read-model.js +101 -0
- package/dist/services/release-artifact-evidence.js +77 -0
- package/dist/services/release-artifact.js +351 -0
- package/dist/services/release-dry-run.js +253 -0
- package/dist/services/release-evidence.js +138 -0
- package/dist/services/release-publish.js +163 -0
- package/dist/services/smoke-evidence.js +104 -0
- package/dist/services/task-read-model.js +125 -0
- package/dist/services/tools-list.js +26 -0
- package/dist/services/write-preflight.js +240 -0
- package/dist/task/task-capsule.js +121 -0
- package/dist/tools/fake-shell.js +56 -0
- package/dist/tui/cache.js +341 -0
- package/dist/tui/constants.js +44 -0
- package/dist/tui/layout.js +140 -0
- package/dist/tui/markdown.js +238 -0
- package/dist/tui/read-model-worker.js +24 -0
- package/dist/tui/read-model.js +502 -0
- package/dist/tui/snapshot.js +434 -0
- package/dist/tui/state.js +229 -0
- package/dist/tui/terminal.js +475 -0
- package/dist/tui/theme.js +86 -0
- package/package.json +16 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createHarnessValidateReport = createHarnessValidateReport;
|
|
4
|
+
const validate_1 = require("../harness/validate");
|
|
5
|
+
function createHarnessValidateReport(projectRoot, taskId, options = {}) {
|
|
6
|
+
return (0, validate_1.validateTaskCapsule)(projectRoot, taskId, options);
|
|
7
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createInstallPlanReport = createInstallPlanReport;
|
|
7
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const schema_1 = require("../core/schema");
|
|
10
|
+
const REQUIRED_NODE_MAJOR = 22;
|
|
11
|
+
function createInstallPlanReport(options = {}) {
|
|
12
|
+
const issues = [];
|
|
13
|
+
const mode = parseMode(options.mode, issues);
|
|
14
|
+
const platform = parsePlatform(options.platform, issues);
|
|
15
|
+
const sourceKind = parseSourceKind(options.sourceKind, options.source, issues);
|
|
16
|
+
const nodeMajor = Number.parseInt(process.versions.node.split('.')[0] ?? '', 10);
|
|
17
|
+
const detectedNode = Number.isFinite(nodeMajor) ? `${nodeMajor}.x` : null;
|
|
18
|
+
const windowsShimRejected = platform === 'wsl' && /node\.exe$/i.test(process.execPath);
|
|
19
|
+
if (nodeMajor !== REQUIRED_NODE_MAJOR) {
|
|
20
|
+
issues.push({
|
|
21
|
+
severity: 'error',
|
|
22
|
+
code: 'NODE_22_REQUIRED',
|
|
23
|
+
message: `HADARA install planning requires Node ${REQUIRED_NODE_MAJOR}.`
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (windowsShimRejected) {
|
|
27
|
+
issues.push({
|
|
28
|
+
severity: 'error',
|
|
29
|
+
code: 'WSL_WINDOWS_NODE_SHIM_REJECTED',
|
|
30
|
+
message: 'WSL install planning requires Linux Node.js, not a Windows node.exe shim.'
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (mode === 'execute') {
|
|
34
|
+
issues.push({
|
|
35
|
+
severity: 'error',
|
|
36
|
+
code: 'INSTALL_EXECUTION_DISABLED',
|
|
37
|
+
message: 'Installer execution is not implemented in this dry-run capsule.'
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const target = createTarget(platform, options, issues);
|
|
41
|
+
const report = {
|
|
42
|
+
schemaVersion: 'hadara.install.plan.v1',
|
|
43
|
+
command: 'install.plan',
|
|
44
|
+
ok: false,
|
|
45
|
+
mode,
|
|
46
|
+
platform,
|
|
47
|
+
source: createSource(sourceKind, options.source),
|
|
48
|
+
target,
|
|
49
|
+
execution: {
|
|
50
|
+
executeEnabled: false,
|
|
51
|
+
disabledIssueCode: 'INSTALL_EXECUTION_DISABLED'
|
|
52
|
+
},
|
|
53
|
+
node: {
|
|
54
|
+
requiredMajor: REQUIRED_NODE_MAJOR,
|
|
55
|
+
detected: detectedNode,
|
|
56
|
+
windowsShimRejected
|
|
57
|
+
},
|
|
58
|
+
actions: createActions(platform),
|
|
59
|
+
issues
|
|
60
|
+
};
|
|
61
|
+
report.ok = report.issues.every((issue) => issue.severity !== 'error');
|
|
62
|
+
(0, schema_1.assertSchema)('hadara.install.plan.v1', report);
|
|
63
|
+
return report;
|
|
64
|
+
}
|
|
65
|
+
function parseMode(value, issues) {
|
|
66
|
+
if (value === undefined || value === 'dry-run')
|
|
67
|
+
return 'dry-run';
|
|
68
|
+
if (value === 'execute')
|
|
69
|
+
return 'execute';
|
|
70
|
+
issues.push({
|
|
71
|
+
severity: 'error',
|
|
72
|
+
code: 'INSTALL_MODE_UNSUPPORTED',
|
|
73
|
+
message: `Unsupported install mode: ${value}`
|
|
74
|
+
});
|
|
75
|
+
return 'dry-run';
|
|
76
|
+
}
|
|
77
|
+
function parsePlatform(value, issues) {
|
|
78
|
+
if (value === undefined)
|
|
79
|
+
return defaultPlatform();
|
|
80
|
+
if (value === 'linux' || value === 'posix' || value === 'windows' || value === 'wsl' || value === 'usb')
|
|
81
|
+
return value;
|
|
82
|
+
issues.push({
|
|
83
|
+
severity: 'error',
|
|
84
|
+
code: 'INSTALL_PLATFORM_UNSUPPORTED',
|
|
85
|
+
message: `Unsupported install platform: ${value}`
|
|
86
|
+
});
|
|
87
|
+
return defaultPlatform();
|
|
88
|
+
}
|
|
89
|
+
function parseSourceKind(value, source, issues) {
|
|
90
|
+
if (value === undefined)
|
|
91
|
+
return inferSourceKind(source);
|
|
92
|
+
if (value === 'tarball' || value === 'directory' || value === 'portable-bundle')
|
|
93
|
+
return value;
|
|
94
|
+
issues.push({
|
|
95
|
+
severity: 'error',
|
|
96
|
+
code: 'INSTALL_SOURCE_KIND_UNSUPPORTED',
|
|
97
|
+
message: `Unsupported install source kind: ${value}`
|
|
98
|
+
});
|
|
99
|
+
return inferSourceKind(source);
|
|
100
|
+
}
|
|
101
|
+
function defaultPlatform() {
|
|
102
|
+
return process.platform === 'win32' ? 'windows' : 'linux';
|
|
103
|
+
}
|
|
104
|
+
function inferSourceKind(source) {
|
|
105
|
+
if (!source)
|
|
106
|
+
return 'directory';
|
|
107
|
+
if (/\.tgz$/i.test(source))
|
|
108
|
+
return 'tarball';
|
|
109
|
+
return 'directory';
|
|
110
|
+
}
|
|
111
|
+
function createSource(kind, source) {
|
|
112
|
+
const relativePath = safeRelativePath(source);
|
|
113
|
+
return {
|
|
114
|
+
kind,
|
|
115
|
+
displayPath: relativePath ? `./${relativePath}` : '<redacted-source>',
|
|
116
|
+
pathRedacted: true,
|
|
117
|
+
...(relativePath ? { relativePath } : {})
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function createTarget(platform, options, issues) {
|
|
121
|
+
const root = platform === 'usb' ? options.usbRoot ?? options.target : options.target ?? options.prefix;
|
|
122
|
+
if (platform === 'usb' && !root) {
|
|
123
|
+
issues.push({
|
|
124
|
+
severity: 'error',
|
|
125
|
+
code: 'USB_ROOT_REQUIRED',
|
|
126
|
+
message: 'USB install planning requires an explicit USB root path, such as --usb-root L:\\HADARA or --usb-root /mnt/l/HADARA.'
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
const defaults = defaultTarget(platform, root);
|
|
130
|
+
const prefix = root ?? defaults.prefix;
|
|
131
|
+
const launcher = options.launcher ?? defaults.launcher;
|
|
132
|
+
return {
|
|
133
|
+
prefix: publicPathRef(prefix, defaults.prefixKind, platform),
|
|
134
|
+
launcher: publicPathRef(launcher, defaults.launcherKind, platform)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function defaultTarget(platform, root) {
|
|
138
|
+
switch (platform) {
|
|
139
|
+
case 'windows':
|
|
140
|
+
return {
|
|
141
|
+
prefix: '%LOCALAPPDATA%\\HADARA',
|
|
142
|
+
launcher: '%LOCALAPPDATA%\\HADARA\\bin\\hadara.cmd',
|
|
143
|
+
prefixKind: 'default',
|
|
144
|
+
launcherKind: 'default'
|
|
145
|
+
};
|
|
146
|
+
case 'usb':
|
|
147
|
+
if (root) {
|
|
148
|
+
return {
|
|
149
|
+
prefix: root,
|
|
150
|
+
launcher: joinPortableLauncher(root),
|
|
151
|
+
prefixKind: 'portable',
|
|
152
|
+
launcherKind: 'portable'
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
prefix: '<usb-root-required>',
|
|
157
|
+
launcher: '<usb-root-required>/portable/bin/hadara',
|
|
158
|
+
prefixKind: 'portable',
|
|
159
|
+
launcherKind: 'portable'
|
|
160
|
+
};
|
|
161
|
+
case 'linux':
|
|
162
|
+
case 'posix':
|
|
163
|
+
case 'wsl':
|
|
164
|
+
default:
|
|
165
|
+
return {
|
|
166
|
+
prefix: '~/.local/share/hadara',
|
|
167
|
+
launcher: '~/.local/bin/hadara',
|
|
168
|
+
prefixKind: 'default',
|
|
169
|
+
launcherKind: 'default'
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function joinPortableLauncher(root) {
|
|
174
|
+
const separator = root.includes('\\') ? '\\' : '/';
|
|
175
|
+
return `${root.replace(/[\\/]+$/, '')}${separator}portable${separator}bin${separator}hadara`;
|
|
176
|
+
}
|
|
177
|
+
function publicPathRef(value, kind, platform) {
|
|
178
|
+
const relativePath = safeRelativePath(value);
|
|
179
|
+
return {
|
|
180
|
+
displayPath: relativePath ? `./${relativePath}` : redactDisplayPath(value, platform),
|
|
181
|
+
pathRedacted: true,
|
|
182
|
+
kind,
|
|
183
|
+
...(relativePath ? { relativePath } : {})
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function safeRelativePath(value) {
|
|
187
|
+
if (!value || node_path_1.default.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value) || value.startsWith('~') || value.startsWith('<') || value.includes('%'))
|
|
188
|
+
return undefined;
|
|
189
|
+
const normalized = value.split(/[\\/]+/).filter(Boolean).join('/');
|
|
190
|
+
if (!normalized || normalized === '.' || normalized.startsWith('..'))
|
|
191
|
+
return undefined;
|
|
192
|
+
return normalized;
|
|
193
|
+
}
|
|
194
|
+
function redactDisplayPath(value, platform) {
|
|
195
|
+
if (value.startsWith('<'))
|
|
196
|
+
return value;
|
|
197
|
+
if (value.startsWith('~') || value.includes('%'))
|
|
198
|
+
return value;
|
|
199
|
+
if (/^[A-Za-z]:[\\/]/.test(value))
|
|
200
|
+
return '<redacted-windows-path>';
|
|
201
|
+
if (node_path_1.default.isAbsolute(value))
|
|
202
|
+
return `<redacted-${redactedPlatformLabel(platform)}-path>`;
|
|
203
|
+
return '<redacted-path>';
|
|
204
|
+
}
|
|
205
|
+
function redactedPlatformLabel(platform) {
|
|
206
|
+
if (platform === 'windows')
|
|
207
|
+
return 'windows';
|
|
208
|
+
if (platform === 'wsl')
|
|
209
|
+
return 'wsl';
|
|
210
|
+
if (platform === 'usb')
|
|
211
|
+
return node_os_1.default.platform() === 'win32' ? 'windows' : 'portable';
|
|
212
|
+
return 'linux';
|
|
213
|
+
}
|
|
214
|
+
function createActions(platform) {
|
|
215
|
+
const launcherKind = platform === 'windows' ? 'create-windows-launcher' : 'create-launcher';
|
|
216
|
+
return [
|
|
217
|
+
{
|
|
218
|
+
kind: 'create-directory',
|
|
219
|
+
description: 'Create install prefix if it does not exist.',
|
|
220
|
+
wouldWrite: true
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
kind: 'copy-bundle',
|
|
224
|
+
description: 'Copy the HADARA package or portable bundle into the install prefix.',
|
|
225
|
+
wouldWrite: true
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
kind: launcherKind,
|
|
229
|
+
description: 'Create a hadara launcher that points at the installed bundle.',
|
|
230
|
+
wouldWrite: true
|
|
231
|
+
}
|
|
232
|
+
];
|
|
233
|
+
}
|