workspace-maxxing 0.1.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/.agents/skills/workspace-maxxing/.workspace-templates/CONTEXT.md +44 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/SYSTEM.md +44 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/references/anti-patterns.md +16 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/references/iron-laws.md +26 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/references/reporting-format.md +52 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/benchmark.ts +171 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/dispatch.ts +473 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/generate-tests.ts +158 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/install-tool.ts +82 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/iterate.ts +265 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/orchestrator.ts +539 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/scaffold.ts +282 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/validate.ts +452 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/architecture/SKILL.md +95 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/fixer/SKILL.md +109 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/iteration/SKILL.md +89 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/prompt-engineering/SKILL.md +87 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/research/SKILL.md +94 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/testing/SKILL.md +89 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/tooling/SKILL.md +87 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/validation/SKILL.md +103 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/worker/SKILL.md +79 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/00-meta/CONTEXT.md +6 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/00-meta/execution-log.md +27 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/01-input/CONTEXT.md +29 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/02-process/CONTEXT.md +29 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/03-output/CONTEXT.md +29 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/README.md +14 -0
- package/.agents/skills/workspace-maxxing/SKILL.md +312 -0
- package/.agents/skills/workspace-maxxing/scripts/benchmark.ts +171 -0
- package/.agents/skills/workspace-maxxing/scripts/dispatch.ts +473 -0
- package/.agents/skills/workspace-maxxing/scripts/generate-tests.ts +158 -0
- package/.agents/skills/workspace-maxxing/scripts/install-tool.ts +82 -0
- package/.agents/skills/workspace-maxxing/scripts/iterate.ts +265 -0
- package/.agents/skills/workspace-maxxing/scripts/orchestrator.ts +539 -0
- package/.agents/skills/workspace-maxxing/scripts/scaffold.ts +282 -0
- package/.agents/skills/workspace-maxxing/scripts/validate.ts +452 -0
- package/README.md +144 -0
- package/dist/agent-creator.d.ts +9 -0
- package/dist/agent-creator.d.ts.map +1 -0
- package/dist/agent-creator.js +199 -0
- package/dist/agent-creator.js.map +1 -0
- package/dist/agent-iterator.d.ts +38 -0
- package/dist/agent-iterator.d.ts.map +1 -0
- package/dist/agent-iterator.js +327 -0
- package/dist/agent-iterator.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +18 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +117 -0
- package/dist/install.js.map +1 -0
- package/dist/platforms/claude.d.ts +7 -0
- package/dist/platforms/claude.d.ts.map +1 -0
- package/dist/platforms/claude.js +70 -0
- package/dist/platforms/claude.js.map +1 -0
- package/dist/platforms/copilot.d.ts +7 -0
- package/dist/platforms/copilot.d.ts.map +1 -0
- package/dist/platforms/copilot.js +75 -0
- package/dist/platforms/copilot.js.map +1 -0
- package/dist/platforms/gemini.d.ts +7 -0
- package/dist/platforms/gemini.d.ts.map +1 -0
- package/dist/platforms/gemini.js +81 -0
- package/dist/platforms/gemini.js.map +1 -0
- package/dist/platforms/index.d.ts +8 -0
- package/dist/platforms/index.d.ts.map +1 -0
- package/dist/platforms/index.js +41 -0
- package/dist/platforms/index.js.map +1 -0
- package/dist/platforms/opencode.d.ts +7 -0
- package/dist/platforms/opencode.d.ts.map +1 -0
- package/dist/platforms/opencode.js +70 -0
- package/dist/platforms/opencode.js.map +1 -0
- package/dist/scripts/benchmark.d.ts +20 -0
- package/dist/scripts/benchmark.d.ts.map +1 -0
- package/dist/scripts/benchmark.js +170 -0
- package/dist/scripts/benchmark.js.map +1 -0
- package/dist/scripts/dispatch.d.ts +32 -0
- package/dist/scripts/dispatch.d.ts.map +1 -0
- package/dist/scripts/dispatch.js +386 -0
- package/dist/scripts/dispatch.js.map +1 -0
- package/dist/scripts/generate-tests.d.ts +11 -0
- package/dist/scripts/generate-tests.d.ts.map +1 -0
- package/dist/scripts/generate-tests.js +118 -0
- package/dist/scripts/generate-tests.js.map +1 -0
- package/dist/scripts/install-tool.d.ts +8 -0
- package/dist/scripts/install-tool.d.ts.map +1 -0
- package/dist/scripts/install-tool.js +98 -0
- package/dist/scripts/install-tool.js.map +1 -0
- package/dist/scripts/iterate.d.ts +44 -0
- package/dist/scripts/iterate.d.ts.map +1 -0
- package/dist/scripts/iterate.js +260 -0
- package/dist/scripts/iterate.js.map +1 -0
- package/dist/scripts/orchestrator.d.ts +40 -0
- package/dist/scripts/orchestrator.d.ts.map +1 -0
- package/dist/scripts/orchestrator.js +378 -0
- package/dist/scripts/orchestrator.js.map +1 -0
- package/dist/scripts/scaffold.d.ts +8 -0
- package/dist/scripts/scaffold.d.ts.map +1 -0
- package/dist/scripts/scaffold.js +279 -0
- package/dist/scripts/scaffold.js.map +1 -0
- package/dist/scripts/validate.d.ts +11 -0
- package/dist/scripts/validate.d.ts.map +1 -0
- package/dist/scripts/validate.js +472 -0
- package/dist/scripts/validate.js.map +1 -0
- package/docs/superpowers/plans/2026-04-07-autonomous-iteration-plan.md +1123 -0
- package/docs/superpowers/plans/2026-04-07-autonomous-iteration-sub-agent-batches.md +1923 -0
- package/docs/superpowers/plans/2026-04-07-autonomous-workflow-sub-skill-plan.md +1505 -0
- package/docs/superpowers/plans/2026-04-07-benchmarking-multi-agent-plan.md +854 -0
- package/docs/superpowers/plans/2026-04-07-workspace-builder-logic-plan.md +1426 -0
- package/docs/superpowers/plans/2026-04-07-workspace-maxxing-plan.md +1299 -0
- package/docs/superpowers/plans/2026-04-08-session-294c-subagent-invocation-plan.md +320 -0
- package/docs/superpowers/plans/2026-04-08-workflow-prompt-hardening-plan.md +1025 -0
- package/docs/superpowers/plans/2026-04-12-workspace-agent-creation-plan.md +992 -0
- package/docs/superpowers/specs/2026-04-07-autonomous-iteration-design.md +214 -0
- package/docs/superpowers/specs/2026-04-07-autonomous-iteration-sub-agent-batches-design.md +188 -0
- package/docs/superpowers/specs/2026-04-07-autonomous-workflow-sub-skill-design.md +137 -0
- package/docs/superpowers/specs/2026-04-07-benchmarking-multi-agent-design.md +105 -0
- package/docs/superpowers/specs/2026-04-07-workspace-builder-logic-design.md +179 -0
- package/docs/superpowers/specs/2026-04-07-workspace-maxxing-design.md +227 -0
- package/docs/superpowers/specs/2026-04-08-session-294c-subagent-invocation-design.md +265 -0
- package/docs/superpowers/specs/2026-04-08-workflow-prompt-hardening-design.md +146 -0
- package/docs/superpowers/specs/2026-04-12-workspace-agent-creation-design.md +239 -0
- package/jest.config.js +8 -0
- package/package.json +32 -0
- package/src/agent-creator.ts +180 -0
- package/src/agent-iterator.ts +397 -0
- package/src/index.ts +189 -0
- package/src/install.ts +105 -0
- package/src/platforms/claude.ts +40 -0
- package/src/platforms/copilot.ts +50 -0
- package/src/platforms/gemini.ts +55 -0
- package/src/platforms/index.ts +45 -0
- package/src/platforms/opencode.ts +41 -0
- package/src/scripts/benchmark.ts +171 -0
- package/src/scripts/dispatch.ts +473 -0
- package/src/scripts/generate-tests.ts +112 -0
- package/src/scripts/install-tool.ts +82 -0
- package/src/scripts/iterate.ts +271 -0
- package/src/scripts/orchestrator.ts +539 -0
- package/src/scripts/scaffold.ts +282 -0
- package/src/scripts/validate.ts +516 -0
- package/templates/.workspace-templates/CONTEXT.md +44 -0
- package/templates/.workspace-templates/SYSTEM.md +44 -0
- package/templates/.workspace-templates/references/anti-patterns.md +16 -0
- package/templates/.workspace-templates/references/iron-laws.md +26 -0
- package/templates/.workspace-templates/references/reporting-format.md +52 -0
- package/templates/.workspace-templates/scripts/benchmark.ts +171 -0
- package/templates/.workspace-templates/scripts/dispatch.ts +473 -0
- package/templates/.workspace-templates/scripts/generate-tests.ts +158 -0
- package/templates/.workspace-templates/scripts/install-tool.ts +82 -0
- package/templates/.workspace-templates/scripts/iterate.ts +265 -0
- package/templates/.workspace-templates/scripts/orchestrator.ts +539 -0
- package/templates/.workspace-templates/scripts/scaffold.ts +282 -0
- package/templates/.workspace-templates/scripts/validate.ts +452 -0
- package/templates/.workspace-templates/skills/architecture/SKILL.md +95 -0
- package/templates/.workspace-templates/skills/fixer/SKILL.md +109 -0
- package/templates/.workspace-templates/skills/iteration/SKILL.md +89 -0
- package/templates/.workspace-templates/skills/prompt-engineering/SKILL.md +87 -0
- package/templates/.workspace-templates/skills/research/SKILL.md +94 -0
- package/templates/.workspace-templates/skills/testing/SKILL.md +89 -0
- package/templates/.workspace-templates/skills/tooling/SKILL.md +87 -0
- package/templates/.workspace-templates/skills/validation/SKILL.md +103 -0
- package/templates/.workspace-templates/skills/worker/SKILL.md +79 -0
- package/templates/.workspace-templates/workspace/00-meta/CONTEXT.md +6 -0
- package/templates/.workspace-templates/workspace/00-meta/execution-log.md +27 -0
- package/templates/.workspace-templates/workspace/01-input/CONTEXT.md +29 -0
- package/templates/.workspace-templates/workspace/02-process/CONTEXT.md +29 -0
- package/templates/.workspace-templates/workspace/03-output/CONTEXT.md +29 -0
- package/templates/.workspace-templates/workspace/README.md +14 -0
- package/templates/SKILL.md +347 -0
- package/tests/benchmark.test.ts +158 -0
- package/tests/cli.test.ts +109 -0
- package/tests/dispatch-parallel.test.ts +124 -0
- package/tests/dispatch.test.ts +218 -0
- package/tests/fixer-skill.test.ts +203 -0
- package/tests/generate-tests.test.ts +101 -0
- package/tests/install-tool.test.ts +141 -0
- package/tests/install.test.ts +144 -0
- package/tests/integration.test.ts +324 -0
- package/tests/iterate.test.ts +219 -0
- package/tests/orchestrator.test.ts +710 -0
- package/tests/scaffold.test.ts +238 -0
- package/tests/templates-enhanced.test.ts +208 -0
- package/tests/templates.test.ts +219 -0
- package/tests/validate.test.ts +421 -0
- package/tests/validation-enhanced.test.ts +303 -0
- package/tests/worker-skill.test.ts +88 -0
- package/tsconfig.json +19 -0
- package/workspace/00-meta/CONTEXT.md +3 -0
- package/workspace/00-meta/execution-log.md +17 -0
- package/workspace/00-meta/tools.md +11 -0
- package/workspace/01-input/CONTEXT.md +27 -0
- package/workspace/CONTEXT.md +35 -0
- package/workspace/README.md +14 -0
- package/workspace/SYSTEM.md +36 -0
- package/workspace-maxxing-0.1.0.tgz +0 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.dispatchSkill = dispatchSkill;
|
|
37
|
+
exports.dispatchParallel = dispatchParallel;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const child_process_1 = require("child_process");
|
|
41
|
+
const SKILL_NEXT_MAP = {
|
|
42
|
+
research: 'architecture',
|
|
43
|
+
architecture: 'none',
|
|
44
|
+
validation: 'prompt-engineering',
|
|
45
|
+
'prompt-engineering': 'testing',
|
|
46
|
+
testing: 'iteration',
|
|
47
|
+
iteration: 'none',
|
|
48
|
+
tooling: 'none',
|
|
49
|
+
worker: 'validation',
|
|
50
|
+
fixer: 'validation',
|
|
51
|
+
};
|
|
52
|
+
function isValidStatus(value) {
|
|
53
|
+
return value === 'passed' || value === 'failed' || value === 'escalated';
|
|
54
|
+
}
|
|
55
|
+
function normalizeStringArray(value) {
|
|
56
|
+
if (!Array.isArray(value)) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
return value
|
|
60
|
+
.map((item) => String(item))
|
|
61
|
+
.filter((item) => item.trim().length > 0);
|
|
62
|
+
}
|
|
63
|
+
function extractJsonPayload(output) {
|
|
64
|
+
const trimmed = output.trim();
|
|
65
|
+
if (!trimmed) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const parsed = JSON.parse(trimmed);
|
|
70
|
+
return typeof parsed === 'object' && parsed !== null
|
|
71
|
+
? parsed
|
|
72
|
+
: null;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Continue trying to parse trailing JSON from mixed runner logs.
|
|
76
|
+
}
|
|
77
|
+
const firstBrace = trimmed.indexOf('{');
|
|
78
|
+
const lastBrace = trimmed.lastIndexOf('}');
|
|
79
|
+
if (firstBrace === -1 || lastBrace === -1 || lastBrace <= firstBrace) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
const candidate = trimmed.slice(firstBrace, lastBrace + 1);
|
|
83
|
+
try {
|
|
84
|
+
const parsed = JSON.parse(candidate);
|
|
85
|
+
return typeof parsed === 'object' && parsed !== null
|
|
86
|
+
? parsed
|
|
87
|
+
: null;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function renderRunnerCommand(template, skillName, options) {
|
|
94
|
+
const invocation = options.invocation;
|
|
95
|
+
const replacements = {
|
|
96
|
+
'{skill}': skillName,
|
|
97
|
+
'{workspace}': options.workspacePath ?? process.cwd(),
|
|
98
|
+
'{batchId}': invocation ? String(invocation.batchId) : '',
|
|
99
|
+
'{testCaseId}': invocation?.testCaseId ?? '',
|
|
100
|
+
};
|
|
101
|
+
return template.replace(/\{skill\}|\{workspace\}|\{batchId\}|\{testCaseId\}/g, (token) => {
|
|
102
|
+
return replacements[token] ?? token;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function createRunnerFailureReport(skillName, message, nextSkill, metrics = {}) {
|
|
106
|
+
return {
|
|
107
|
+
skill: skillName,
|
|
108
|
+
status: 'failed',
|
|
109
|
+
timestamp: new Date().toISOString(),
|
|
110
|
+
findings: [message],
|
|
111
|
+
recommendations: ['Inspect runner command and ensure it outputs a valid JSON report'],
|
|
112
|
+
metrics,
|
|
113
|
+
nextSkill,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function truncateTelemetryText(value, maxLength = 2000) {
|
|
117
|
+
if (value.length <= maxLength) {
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
return `${value.slice(0, maxLength)}...`;
|
|
121
|
+
}
|
|
122
|
+
function writeRunnerTelemetry(skillName, options, details) {
|
|
123
|
+
try {
|
|
124
|
+
const runsDir = path.join(options.workspacePath ?? process.cwd(), '.agents', 'iteration', 'runs');
|
|
125
|
+
fs.mkdirSync(runsDir, { recursive: true });
|
|
126
|
+
const batchToken = options.invocation ? String(options.invocation.batchId) : 'na';
|
|
127
|
+
const testCaseToken = options.invocation?.testCaseId ? options.invocation.testCaseId.replace(/[^a-zA-Z0-9-_]/g, '_') : 'na';
|
|
128
|
+
const fileName = `${Date.now()}-${skillName}-${batchToken}-${testCaseToken}.json`;
|
|
129
|
+
const filePath = path.join(runsDir, fileName);
|
|
130
|
+
const telemetry = {
|
|
131
|
+
skill: skillName,
|
|
132
|
+
status: details.status,
|
|
133
|
+
timestamp: details.timestamp,
|
|
134
|
+
batchId: options.invocation?.batchId,
|
|
135
|
+
testCaseId: options.invocation?.testCaseId,
|
|
136
|
+
commandTemplate: details.commandTemplate,
|
|
137
|
+
renderedCommand: details.renderedCommand,
|
|
138
|
+
durationMs: details.durationMs,
|
|
139
|
+
exitCode: details.exitCode,
|
|
140
|
+
timedOut: details.timedOut,
|
|
141
|
+
parsedPayload: details.parsedPayload,
|
|
142
|
+
stdoutLength: details.stdout.length,
|
|
143
|
+
stderrLength: details.stderr.length,
|
|
144
|
+
stdoutPreview: truncateTelemetryText(details.stdout),
|
|
145
|
+
stderrPreview: truncateTelemetryText(details.stderr),
|
|
146
|
+
};
|
|
147
|
+
fs.writeFileSync(filePath, JSON.stringify(telemetry, null, 2));
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
// Best-effort telemetry; dispatch result should not fail due to telemetry write issues.
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function runExternalRunner(skillName, options) {
|
|
154
|
+
if (!options.runnerCommand) {
|
|
155
|
+
return createRunnerFailureReport(skillName, 'Runner command is required for external dispatch mode', 'none');
|
|
156
|
+
}
|
|
157
|
+
const command = renderRunnerCommand(options.runnerCommand, skillName, options);
|
|
158
|
+
const startedAt = Date.now();
|
|
159
|
+
const timeoutMs = (options.runnerTimeoutSeconds ?? 300) * 1000;
|
|
160
|
+
try {
|
|
161
|
+
const stdout = (0, child_process_1.execFileSync)(command, {
|
|
162
|
+
cwd: options.workspacePath ?? process.cwd(),
|
|
163
|
+
encoding: 'utf-8',
|
|
164
|
+
shell: true,
|
|
165
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
166
|
+
timeout: timeoutMs,
|
|
167
|
+
});
|
|
168
|
+
const parsed = extractJsonPayload(stdout);
|
|
169
|
+
const elapsedMs = Date.now() - startedAt;
|
|
170
|
+
const nextSkill = SKILL_NEXT_MAP[skillName] ?? 'none';
|
|
171
|
+
const commandTemplate = options.runnerCommand ?? '';
|
|
172
|
+
if (!parsed) {
|
|
173
|
+
const report = {
|
|
174
|
+
skill: skillName,
|
|
175
|
+
status: 'passed',
|
|
176
|
+
timestamp: new Date().toISOString(),
|
|
177
|
+
findings: ['External runner completed without JSON payload'],
|
|
178
|
+
recommendations: ['Emit JSON report for richer metrics and routing decisions'],
|
|
179
|
+
metrics: {
|
|
180
|
+
executionTimeMs: elapsedMs,
|
|
181
|
+
outputLength: stdout.length,
|
|
182
|
+
},
|
|
183
|
+
nextSkill,
|
|
184
|
+
};
|
|
185
|
+
writeRunnerTelemetry(skillName, options, {
|
|
186
|
+
commandTemplate,
|
|
187
|
+
renderedCommand: command,
|
|
188
|
+
status: report.status,
|
|
189
|
+
timestamp: report.timestamp,
|
|
190
|
+
durationMs: elapsedMs,
|
|
191
|
+
exitCode: 0,
|
|
192
|
+
timedOut: 0,
|
|
193
|
+
stdout,
|
|
194
|
+
stderr: '',
|
|
195
|
+
parsedPayload: 0,
|
|
196
|
+
});
|
|
197
|
+
return report;
|
|
198
|
+
}
|
|
199
|
+
const findings = normalizeStringArray(parsed.findings);
|
|
200
|
+
const recommendations = normalizeStringArray(parsed.recommendations);
|
|
201
|
+
const rawMetrics = parsed.metrics;
|
|
202
|
+
const metrics = typeof rawMetrics === 'object' && rawMetrics !== null
|
|
203
|
+
? rawMetrics
|
|
204
|
+
: {};
|
|
205
|
+
const report = {
|
|
206
|
+
skill: typeof parsed.skill === 'string' && parsed.skill.trim()
|
|
207
|
+
? parsed.skill
|
|
208
|
+
: skillName,
|
|
209
|
+
status: isValidStatus(parsed.status) ? parsed.status : 'passed',
|
|
210
|
+
timestamp: typeof parsed.timestamp === 'string' && parsed.timestamp.trim()
|
|
211
|
+
? parsed.timestamp
|
|
212
|
+
: new Date().toISOString(),
|
|
213
|
+
findings: findings.length > 0 ? findings : ['External runner completed'],
|
|
214
|
+
recommendations: recommendations.length > 0
|
|
215
|
+
? recommendations
|
|
216
|
+
: ['Proceed using the returned runner output'],
|
|
217
|
+
metrics: {
|
|
218
|
+
...metrics,
|
|
219
|
+
executionTimeMs: typeof metrics.executionTimeMs === 'number'
|
|
220
|
+
? metrics.executionTimeMs
|
|
221
|
+
: elapsedMs,
|
|
222
|
+
},
|
|
223
|
+
nextSkill: typeof parsed.nextSkill === 'string' && parsed.nextSkill.trim()
|
|
224
|
+
? parsed.nextSkill
|
|
225
|
+
: nextSkill,
|
|
226
|
+
};
|
|
227
|
+
writeRunnerTelemetry(skillName, options, {
|
|
228
|
+
commandTemplate,
|
|
229
|
+
renderedCommand: command,
|
|
230
|
+
status: report.status,
|
|
231
|
+
timestamp: report.timestamp,
|
|
232
|
+
durationMs: elapsedMs,
|
|
233
|
+
exitCode: 0,
|
|
234
|
+
timedOut: 0,
|
|
235
|
+
stdout,
|
|
236
|
+
stderr: '',
|
|
237
|
+
parsedPayload: 1,
|
|
238
|
+
});
|
|
239
|
+
return report;
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
const err = error;
|
|
243
|
+
const stderr = err.stderr ? String(err.stderr).trim() : '';
|
|
244
|
+
const stdout = err.stdout ? String(err.stdout).trim() : '';
|
|
245
|
+
const baseMessage = err.message ?? 'External runner failed';
|
|
246
|
+
const detailMessage = [stderr, stdout].find((value) => value.length > 0) ?? baseMessage;
|
|
247
|
+
const failureReport = createRunnerFailureReport(skillName, detailMessage, 'none', {
|
|
248
|
+
exitCode: typeof err.status === 'number' ? err.status : -1,
|
|
249
|
+
timedOut: err.signal === 'SIGTERM' || err.killed ? 1 : 0,
|
|
250
|
+
});
|
|
251
|
+
writeRunnerTelemetry(skillName, options, {
|
|
252
|
+
commandTemplate: options.runnerCommand ?? '',
|
|
253
|
+
renderedCommand: command,
|
|
254
|
+
status: failureReport.status,
|
|
255
|
+
timestamp: failureReport.timestamp,
|
|
256
|
+
durationMs: Date.now() - startedAt,
|
|
257
|
+
exitCode: typeof err.status === 'number' ? err.status : -1,
|
|
258
|
+
timedOut: err.signal === 'SIGTERM' || err.killed ? 1 : 0,
|
|
259
|
+
stdout,
|
|
260
|
+
stderr,
|
|
261
|
+
parsedPayload: 0,
|
|
262
|
+
});
|
|
263
|
+
return failureReport;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function dispatchSkill(skillName, skillsDir, options = {}) {
|
|
267
|
+
const skillPath = path.join(skillsDir, skillName, 'SKILL.md');
|
|
268
|
+
if (!fs.existsSync(skillPath)) {
|
|
269
|
+
return {
|
|
270
|
+
skill: skillName,
|
|
271
|
+
status: 'failed',
|
|
272
|
+
timestamp: new Date().toISOString(),
|
|
273
|
+
findings: [`Sub-skill SKILL.md not found: ${skillPath}`],
|
|
274
|
+
recommendations: ['Ensure the sub-skill directory and SKILL.md exist'],
|
|
275
|
+
metrics: {},
|
|
276
|
+
nextSkill: 'none',
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
const content = fs.readFileSync(skillPath, 'utf-8');
|
|
280
|
+
const nameMatch = content.match(/^---\nname:\s*(.+)$/m);
|
|
281
|
+
const skill = nameMatch ? nameMatch[1].trim() : skillName;
|
|
282
|
+
const requiresExternalRunner = skillName === 'worker' || skillName === 'fixer';
|
|
283
|
+
if (requiresExternalRunner && !options.runnerCommand) {
|
|
284
|
+
return createRunnerFailureReport(skillName, 'External sub-agent runner is required for worker/fixer', 'none');
|
|
285
|
+
}
|
|
286
|
+
const usesExternalRunner = Boolean(options.runnerCommand && (skillName === 'worker' || skillName === 'fixer'));
|
|
287
|
+
if (usesExternalRunner) {
|
|
288
|
+
return runExternalRunner(skillName, options);
|
|
289
|
+
}
|
|
290
|
+
const fallbackRecommendations = ['Follow the sub-skill instructions to complete the task'];
|
|
291
|
+
if (skillName === 'worker' || skillName === 'fixer') {
|
|
292
|
+
fallbackRecommendations.push('Configure --runner-command or WORKSPACE_MAXXING_SUBAGENT_RUNNER for true sub-agent execution');
|
|
293
|
+
}
|
|
294
|
+
return {
|
|
295
|
+
skill,
|
|
296
|
+
status: 'passed',
|
|
297
|
+
timestamp: new Date().toISOString(),
|
|
298
|
+
findings: [`Sub-skill "${skill}" loaded successfully`],
|
|
299
|
+
recommendations: fallbackRecommendations,
|
|
300
|
+
metrics: {
|
|
301
|
+
contentLength: content.length,
|
|
302
|
+
simulatedDispatch: skillName === 'worker' || skillName === 'fixer' ? 1 : 0,
|
|
303
|
+
},
|
|
304
|
+
nextSkill: SKILL_NEXT_MAP[skillName] ?? 'none',
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
function dispatchParallel(invocations, skillsDir, options = {}) {
|
|
308
|
+
return invocations.map((inv) => {
|
|
309
|
+
const report = dispatchSkill(inv.skill, skillsDir, {
|
|
310
|
+
...options,
|
|
311
|
+
invocation: inv,
|
|
312
|
+
});
|
|
313
|
+
return {
|
|
314
|
+
...report,
|
|
315
|
+
batchId: inv.batchId,
|
|
316
|
+
testCaseId: inv.testCaseId,
|
|
317
|
+
};
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
if (require.main === module) {
|
|
321
|
+
const args = process.argv.slice(2);
|
|
322
|
+
const parseArg = (flag) => {
|
|
323
|
+
const idx = args.indexOf(flag);
|
|
324
|
+
return idx !== -1 ? args[idx + 1] : undefined;
|
|
325
|
+
};
|
|
326
|
+
const skill = parseArg('--skill');
|
|
327
|
+
const workspace = parseArg('--workspace');
|
|
328
|
+
const batchId = parseArg('--batch-id');
|
|
329
|
+
const testCaseId = parseArg('--test-case-id');
|
|
330
|
+
const parallel = args.includes('--parallel');
|
|
331
|
+
const invocationsPath = parseArg('--invocations');
|
|
332
|
+
const runnerCommand = parseArg('--runner-command') ?? process.env.WORKSPACE_MAXXING_SUBAGENT_RUNNER;
|
|
333
|
+
const runnerTimeoutRaw = parseArg('--runner-timeout');
|
|
334
|
+
let runnerTimeoutSeconds;
|
|
335
|
+
if (runnerTimeoutRaw !== undefined) {
|
|
336
|
+
const parsedTimeout = Number(runnerTimeoutRaw);
|
|
337
|
+
if (!Number.isFinite(parsedTimeout) || parsedTimeout <= 0) {
|
|
338
|
+
console.error('--runner-timeout must be a positive number of seconds');
|
|
339
|
+
process.exit(1);
|
|
340
|
+
}
|
|
341
|
+
runnerTimeoutSeconds = parsedTimeout;
|
|
342
|
+
}
|
|
343
|
+
const skillsDir = workspace
|
|
344
|
+
? path.join(workspace, '.agents', 'skills', 'workspace-maxxing', 'skills')
|
|
345
|
+
: path.join(process.cwd(), 'skills');
|
|
346
|
+
const dispatchOptions = {
|
|
347
|
+
workspacePath: workspace,
|
|
348
|
+
runnerCommand,
|
|
349
|
+
runnerTimeoutSeconds,
|
|
350
|
+
};
|
|
351
|
+
if (parallel) {
|
|
352
|
+
if (!invocationsPath) {
|
|
353
|
+
console.error('--parallel requires --invocations <path>');
|
|
354
|
+
process.exit(1);
|
|
355
|
+
}
|
|
356
|
+
const parsed = JSON.parse(fs.readFileSync(invocationsPath, 'utf-8'));
|
|
357
|
+
if (!Array.isArray(parsed)) {
|
|
358
|
+
console.error('--invocations must point to a JSON array');
|
|
359
|
+
process.exit(1);
|
|
360
|
+
}
|
|
361
|
+
const results = dispatchParallel(parsed, skillsDir, dispatchOptions);
|
|
362
|
+
console.log(JSON.stringify(results, null, 2));
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
if (!skill) {
|
|
366
|
+
console.error('Usage: node dispatch.ts --skill <name> --workspace <path> [--batch-id <n>] [--parallel --invocations <path>]');
|
|
367
|
+
process.exit(1);
|
|
368
|
+
}
|
|
369
|
+
const singleInvocation = batchId
|
|
370
|
+
? {
|
|
371
|
+
skill,
|
|
372
|
+
batchId: parseInt(batchId, 10),
|
|
373
|
+
testCaseId: testCaseId ?? '',
|
|
374
|
+
}
|
|
375
|
+
: undefined;
|
|
376
|
+
const result = dispatchSkill(skill, skillsDir, {
|
|
377
|
+
...dispatchOptions,
|
|
378
|
+
invocation: singleInvocation,
|
|
379
|
+
});
|
|
380
|
+
const output = batchId
|
|
381
|
+
? { ...result, batchId: parseInt(batchId, 10) }
|
|
382
|
+
: result;
|
|
383
|
+
console.log(JSON.stringify(output, null, 2));
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
//# sourceMappingURL=dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../src/scripts/dispatch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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,11 @@
|
|
|
1
|
+
export interface TestCase {
|
|
2
|
+
stage: string;
|
|
3
|
+
type: 'sample' | 'edge-case' | 'empty';
|
|
4
|
+
input: string;
|
|
5
|
+
expected: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TestCasesOutput {
|
|
8
|
+
testCases: TestCase[];
|
|
9
|
+
}
|
|
10
|
+
export declare function generateTestCases(workspacePath: string, outputPath?: string): TestCasesOutput;
|
|
11
|
+
//# sourceMappingURL=generate-tests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-tests.d.ts","sourceRoot":"","sources":["../../src/scripts/generate-tests.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,OAAO,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,GAClB,eAAe,CAmDjB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.generateTestCases = generateTestCases;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
function generateTestCases(workspacePath, outputPath) {
|
|
40
|
+
const ws = path.resolve(workspacePath);
|
|
41
|
+
const testCases = [];
|
|
42
|
+
const stageFolders = getNumberedFolders(ws);
|
|
43
|
+
if (stageFolders.length === 0) {
|
|
44
|
+
console.warn('Warning: No numbered stage folders found in workspace');
|
|
45
|
+
}
|
|
46
|
+
for (const stage of stageFolders) {
|
|
47
|
+
const contextPath = path.join(ws, stage, 'CONTEXT.md');
|
|
48
|
+
let purpose = '';
|
|
49
|
+
if (fs.existsSync(contextPath)) {
|
|
50
|
+
const content = fs.readFileSync(contextPath, 'utf-8');
|
|
51
|
+
const purposeMatch = content.match(/## Purpose\n([\s\S]*?)(?=##|$)/i);
|
|
52
|
+
if (purposeMatch) {
|
|
53
|
+
purpose = purposeMatch[1].trim();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
testCases.push({
|
|
57
|
+
stage,
|
|
58
|
+
type: 'sample',
|
|
59
|
+
input: generateSampleInput(stage, purpose),
|
|
60
|
+
expected: `Stage should fulfill its purpose: ${purpose || 'handle stage-specific processing'}`,
|
|
61
|
+
});
|
|
62
|
+
testCases.push({
|
|
63
|
+
stage,
|
|
64
|
+
type: 'edge-case',
|
|
65
|
+
input: generateEdgeCaseInput(stage),
|
|
66
|
+
expected: `Stage should handle edge case gracefully`,
|
|
67
|
+
});
|
|
68
|
+
testCases.push({
|
|
69
|
+
stage,
|
|
70
|
+
type: 'empty',
|
|
71
|
+
input: '',
|
|
72
|
+
expected: `Stage should handle empty input gracefully`,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const result = { testCases };
|
|
76
|
+
if (outputPath) {
|
|
77
|
+
fs.writeFileSync(outputPath, JSON.stringify(result, null, 2));
|
|
78
|
+
console.log(`Test cases written to: ${outputPath}`);
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
function generateSampleInput(stage, purpose) {
|
|
83
|
+
const samples = {
|
|
84
|
+
'01-input': 'A sample input document with valid data for processing',
|
|
85
|
+
'02-process': 'Processed data from the input stage ready for transformation',
|
|
86
|
+
'03-output': 'Final processed data ready for report generation',
|
|
87
|
+
};
|
|
88
|
+
return samples[stage] || `Sample data for ${stage}`;
|
|
89
|
+
}
|
|
90
|
+
function generateEdgeCaseInput(stage) {
|
|
91
|
+
const edgeCases = {
|
|
92
|
+
'01-input': 'Input with special characters: <>&"\' and very long text that exceeds normal length expectations',
|
|
93
|
+
'02-process': 'Data with missing fields and inconsistent formatting',
|
|
94
|
+
'03-output': 'Conflicting output requirements from upstream stages',
|
|
95
|
+
};
|
|
96
|
+
return edgeCases[stage] || `Edge case data for ${stage}`;
|
|
97
|
+
}
|
|
98
|
+
function getNumberedFolders(workspacePath) {
|
|
99
|
+
const entries = fs.readdirSync(workspacePath, { withFileTypes: true });
|
|
100
|
+
return entries
|
|
101
|
+
.filter((e) => e.isDirectory() && /^\d{2}-/.test(e.name) && e.name !== '00-meta')
|
|
102
|
+
.map((e) => e.name);
|
|
103
|
+
}
|
|
104
|
+
if (require.main === module) {
|
|
105
|
+
const args = process.argv.slice(2);
|
|
106
|
+
const parseArg = (flag) => {
|
|
107
|
+
const idx = args.indexOf(flag);
|
|
108
|
+
return idx !== -1 ? args[idx + 1] : undefined;
|
|
109
|
+
};
|
|
110
|
+
const workspace = parseArg('--workspace');
|
|
111
|
+
const output = parseArg('--output');
|
|
112
|
+
if (!workspace) {
|
|
113
|
+
console.error('Usage: node generate-tests.ts --workspace <path> [--output <path>]');
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
generateTestCases(workspace, output);
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=generate-tests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-tests.js","sourceRoot":"","sources":["../../src/scripts/generate-tests.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,8CAsDC;AApED,uCAAyB;AACzB,2CAA6B;AAa7B,SAAgB,iBAAiB,CAC/B,aAAqB,EACrB,UAAmB;IAEnB,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACvC,MAAM,SAAS,GAAe,EAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAE5C,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK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M,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IAEpC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;QACpF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,iBAAiB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type PackageManager = 'npm' | 'pip' | 'npx' | 'brew';
|
|
2
|
+
export interface InstallToolOptions {
|
|
3
|
+
tool: string;
|
|
4
|
+
manager: PackageManager;
|
|
5
|
+
workspace: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function installTool(options: InstallToolOptions): void;
|
|
8
|
+
//# sourceMappingURL=install-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-tool.d.ts","sourceRoot":"","sources":["../../src/scripts/install-tool.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAsB7D"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.installTool = installTool;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const child_process_1 = require("child_process");
|
|
40
|
+
function installTool(options) {
|
|
41
|
+
const { tool, manager, workspace } = options;
|
|
42
|
+
const ws = path.resolve(workspace);
|
|
43
|
+
const validManagers = ['npm', 'pip', 'npx', 'brew'];
|
|
44
|
+
if (!validManagers.includes(manager)) {
|
|
45
|
+
throw new Error(`Unsupported package manager: ${manager}. Supported: ${validManagers.join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
const command = manager === 'npx' ? `npx ${tool}` : `${manager} install ${tool}`;
|
|
48
|
+
console.log(`Installing ${tool} via ${manager}...`);
|
|
49
|
+
try {
|
|
50
|
+
(0, child_process_1.execSync)(command, { cwd: ws, stdio: 'inherit' });
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
54
|
+
throw new Error(`Failed to install ${tool}: ${message}`);
|
|
55
|
+
}
|
|
56
|
+
updateToolsMd(ws, tool, manager);
|
|
57
|
+
console.log(`✓ ${tool} installed and added to tool inventory`);
|
|
58
|
+
}
|
|
59
|
+
function updateToolsMd(workspace, tool, manager) {
|
|
60
|
+
const toolsMdPath = path.join(workspace, '00-meta', 'tools.md');
|
|
61
|
+
if (!fs.existsSync(toolsMdPath)) {
|
|
62
|
+
throw new Error(`tools.md not found at: ${toolsMdPath}`);
|
|
63
|
+
}
|
|
64
|
+
const content = fs.readFileSync(toolsMdPath, 'utf-8');
|
|
65
|
+
const now = new Date().toISOString().split('T')[0];
|
|
66
|
+
const placeholderRow = '| — | — | — | — |';
|
|
67
|
+
const newRow = `| ${tool} | latest | ${manager} | ${now} |`;
|
|
68
|
+
let updated;
|
|
69
|
+
if (content.includes(placeholderRow)) {
|
|
70
|
+
updated = content.replace(placeholderRow, `${placeholderRow}\n${newRow}`);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const pendingIdx = content.indexOf('## Pending Tools');
|
|
74
|
+
if (pendingIdx !== -1) {
|
|
75
|
+
updated = content.slice(0, pendingIdx) + newRow + '\n\n' + content.slice(pendingIdx);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
updated = content + '\n' + newRow + '\n';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
fs.writeFileSync(toolsMdPath, updated);
|
|
82
|
+
}
|
|
83
|
+
if (require.main === module) {
|
|
84
|
+
const args = process.argv.slice(2);
|
|
85
|
+
const parseArg = (flag) => {
|
|
86
|
+
const idx = args.indexOf(flag);
|
|
87
|
+
return idx !== -1 ? args[idx + 1] : undefined;
|
|
88
|
+
};
|
|
89
|
+
const tool = parseArg('--tool');
|
|
90
|
+
const manager = parseArg('--manager');
|
|
91
|
+
const workspace = parseArg('--workspace');
|
|
92
|
+
if (!tool || !manager || !workspace) {
|
|
93
|
+
console.error('Usage: node install-tool.ts --tool <name> --manager <npm|pip|npx|brew> --workspace <path>');
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
installTool({ tool, manager, workspace });
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=install-tool.js.map
|