nadial-logic
v1.0.0
Published
Core logic for NadiaL, enabling multi-round fulfillment processes, directory scanning, and contextual verification for research and project analysis.
Maintainers
Readme
nadial-logic
This package contains the core fulfillment logic for the NadiaL Monorepo. It provides functions for scanning directories based on a configuration and validating these configurations.
Installation
npm install nadial-logicQuickstart
Programmatic Usage
You can use the run and validateConfig functions directly in your Node.js applications.
const { run, validateConfig } = require('nadial-logic');
const path = require('path');
// Example Configuration
const config = {
main: path.resolve(__dirname, './my-project-root'), // The main directory to scan
scanFor: ['adapters', 'modules'], // Folder names to look for
siblings: ['README.md'], // Files/folders that must exist at the sibling level
// ... other configuration options
};
// Validate the configuration
const errors = validateConfig(config);
if (errors.length > 0) {
console.error('Configuration errors:', errors);
} else {
// Run the fulfillment logic
run(config)
.then(summary => {
console.log('NadiaL Summary:', JSON.stringify(summary, null, 2));
})
.catch(error => {
console.error('NadiaL process failed:', error.message);
});
}
// You can also pass a path to a JSON config file:
// run('./path/to/your/config.json').then(...);CLI Usage (within the monorepo)
If you are within the NadiaL Monorepo, you can use the root-level script to run a NadiaL process with a JSON configuration file:
npm run run-fulfillment -- <path-to-your-config.json>For example:
npm run run-fulfillment -- packages/admin-server/data/1.jsonAPI
run(configOrPath, options?)
Runs the NadiaL logic (fulfillment) based on the provided configuration.
configOrPath: (Object | string) A configuration object or a path to a JSON configuration file.options: (Object, optional) Options for running the NadiaL process (e.g.,workers,noWorkers,onChunk,signal).
Returns a Promise that resolves to a summary object containing the scan results.
validateConfig(config)
Validates a given configuration object.
config: (Object) The configuration object to validate.
Returns an array of strings, where each string is an error message. An empty array means the configuration is valid.
DEFAULT_IGNORES
An array of default directory names that are ignored during scanning (e.g., node_modules, .git).
version
The version string of the package.
