@synergenius/flow-weaver 0.11.0 → 0.12.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/dist/api/compile.js +1 -3
- package/dist/cli/commands/context.d.ts +13 -0
- package/dist/cli/commands/context.js +53 -0
- package/dist/cli/flow-weaver.mjs +675 -219
- package/dist/cli/index.js +20 -0
- package/dist/context/index.d.ts +30 -0
- package/dist/context/index.js +182 -0
- package/dist/doc-metadata/extractors/mcp-tools.js +40 -0
- package/dist/generated-version.d.ts +2 -0
- package/dist/generated-version.js +3 -0
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/tools-context.d.ts +3 -0
- package/dist/mcp/tools-context.js +51 -0
- package/docs/reference/cli-reference.md +33 -1
- package/package.json +2 -1
package/dist/api/compile.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as fs from 'node:fs/promises';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
2
|
import * as path from 'node:path';
|
|
4
|
-
|
|
5
|
-
const { version: COMPILER_VERSION } = require('../../package.json');
|
|
3
|
+
import { VERSION as COMPILER_VERSION } from '../generated-version.js';
|
|
6
4
|
import { generateCode } from './generate.js';
|
|
7
5
|
import { generateInPlace } from './generate-in-place.js';
|
|
8
6
|
import { parseWorkflow } from './parse.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context command - generate LLM context bundles from documentation and grammar
|
|
3
|
+
*/
|
|
4
|
+
export interface ContextCommandOptions {
|
|
5
|
+
profile?: string;
|
|
6
|
+
topics?: string;
|
|
7
|
+
add?: string;
|
|
8
|
+
grammar?: boolean;
|
|
9
|
+
output?: string;
|
|
10
|
+
list?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function contextCommand(preset: string | undefined, options: ContextCommandOptions): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context command - generate LLM context bundles from documentation and grammar
|
|
3
|
+
*/
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import { buildContext, PRESETS, PRESET_NAMES } from '../../context/index.js';
|
|
6
|
+
import { logger } from '../utils/logger.js';
|
|
7
|
+
export async function contextCommand(preset, options) {
|
|
8
|
+
// --list: show presets and exit
|
|
9
|
+
if (options.list) {
|
|
10
|
+
logger.section('Context Presets');
|
|
11
|
+
logger.newline();
|
|
12
|
+
const maxName = Math.max(...PRESET_NAMES.map((n) => n.length));
|
|
13
|
+
for (const name of PRESET_NAMES) {
|
|
14
|
+
const topics = PRESETS[name];
|
|
15
|
+
logger.log(` ${name.padEnd(maxName + 2)} ${topics.join(', ')}`);
|
|
16
|
+
}
|
|
17
|
+
logger.newline();
|
|
18
|
+
logger.log(' Usage: flow-weaver context [preset] [options]');
|
|
19
|
+
logger.newline();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Validate preset
|
|
23
|
+
const presetName = (preset ?? 'core');
|
|
24
|
+
if (!PRESET_NAMES.includes(presetName) && !options.topics) {
|
|
25
|
+
logger.error(`Unknown preset "${preset}". Available: ${PRESET_NAMES.join(', ')}. Or use --topics to specify topics directly.`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
// Validate profile
|
|
29
|
+
const profile = options.profile ?? 'standalone';
|
|
30
|
+
if (profile !== 'standalone' && profile !== 'assistant') {
|
|
31
|
+
logger.error(`Unknown profile "${profile}". Use "standalone" or "assistant".`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
const result = buildContext({
|
|
35
|
+
preset: PRESET_NAMES.includes(presetName) ? presetName : 'core',
|
|
36
|
+
profile: profile,
|
|
37
|
+
topics: options.topics ? options.topics.split(',').map((s) => s.trim()) : undefined,
|
|
38
|
+
addTopics: options.add ? options.add.split(',').map((s) => s.trim()) : undefined,
|
|
39
|
+
includeGrammar: options.grammar !== false,
|
|
40
|
+
});
|
|
41
|
+
// Write output
|
|
42
|
+
if (options.output) {
|
|
43
|
+
fs.writeFileSync(options.output, result.content, 'utf-8');
|
|
44
|
+
logger.success(`Context written to ${options.output}`);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
process.stdout.write(result.content);
|
|
48
|
+
}
|
|
49
|
+
// Stats to stderr (doesn't pollute piped stdout)
|
|
50
|
+
const stats = `${result.topicCount} topics, ${result.lineCount} lines (${result.profile} profile)`;
|
|
51
|
+
process.stderr.write(`flow-weaver context: ${stats}\n`);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=context.js.map
|