instrux 0.1.0 → 0.3.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-APACHE +13 -0
- package/LICENSE-MIT +21 -0
- package/README.md +149 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +106 -12
- package/dist/cli.js.map +1 -1
- package/dist/compiler.d.ts +2 -2
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js.map +1 -1
- package/dist/engine.d.ts +21 -8
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +62 -7
- package/dist/engine.js.map +1 -1
- package/dist/engine.test.d.ts +5 -0
- package/dist/engine.test.d.ts.map +1 -0
- package/dist/engine.test.js +319 -0
- package/dist/engine.test.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +4 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +61 -9
- package/dist/init.js.map +1 -1
- package/dist/init.test.d.ts +5 -0
- package/dist/init.test.d.ts.map +1 -0
- package/dist/init.test.js +192 -0
- package/dist/init.test.js.map +1 -0
- package/dist/types.d.ts +29 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +11 -3
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2026 Travis Sharp
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Travis Sharp
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -39,6 +39,7 @@ instrux build MyAgent
|
|
|
39
39
|
|---|---|
|
|
40
40
|
| `instrux init <name>` | Scaffold a simple-merge agent |
|
|
41
41
|
| `instrux init -t <name>` | Scaffold a template-compiled agent |
|
|
42
|
+
| `instrux config:init` | Create repository-level config file |
|
|
42
43
|
| `instrux build <name>` | Build (merge or compile) an agent |
|
|
43
44
|
| `instrux build --all` | Build all agents |
|
|
44
45
|
| `instrux list` | List all agents |
|
|
@@ -47,6 +48,114 @@ instrux build MyAgent
|
|
|
47
48
|
|
|
48
49
|
---
|
|
49
50
|
|
|
51
|
+
## Repository Configuration
|
|
52
|
+
|
|
53
|
+
A repository-level config file (`instrux.json`) at your project root sets default settings for all agents.
|
|
54
|
+
|
|
55
|
+
**Auto-creation:** When you run `instrux init` for the first time, the repository config is created automatically with sensible defaults.
|
|
56
|
+
|
|
57
|
+
You can also create it manually:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
instrux config:init
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This creates an `instrux.json` file with default settings:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"agentsDirectory": "agents",
|
|
68
|
+
"outputDirectory": "out",
|
|
69
|
+
"mergeSettings": {
|
|
70
|
+
"addSeparators": true,
|
|
71
|
+
"separatorStyle": "---",
|
|
72
|
+
"includeFileHeaders": false,
|
|
73
|
+
"preserveFormatting": true,
|
|
74
|
+
"generateHash": false,
|
|
75
|
+
"useTimestamp": false
|
|
76
|
+
},
|
|
77
|
+
"frontmatter": {
|
|
78
|
+
"output": "strip"
|
|
79
|
+
},
|
|
80
|
+
"sources": ["agents/base/**/*.md"]
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Configuration Options:**
|
|
85
|
+
|
|
86
|
+
| Field | Default | Description |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `agentsDirectory` | `"agents"` | Directory containing agent folders (e.g., `"src/agents"` for src/agents/MyAgent/) |
|
|
89
|
+
| `outputDirectory` | `"out"` | Where to write compiled output files |
|
|
90
|
+
| `mergeSettings` | See above | Default merge behavior for all agents |
|
|
91
|
+
| `frontmatter` | `{ output: "strip" }` | How to handle frontmatter in output |
|
|
92
|
+
| `sources` | `["agents/base/**/*.md"]` | Default source patterns for template mode |
|
|
93
|
+
|
|
94
|
+
**Benefits:**
|
|
95
|
+
- Set defaults once for all agents
|
|
96
|
+
- Individual agent configs inherit these settings
|
|
97
|
+
- Agent configs can override any setting
|
|
98
|
+
- Keep agent configs minimal and focused
|
|
99
|
+
|
|
100
|
+
**Example workflow:**
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# 1. Create your first agent (auto-creates instrux.json)
|
|
104
|
+
instrux init MyAgent
|
|
105
|
+
|
|
106
|
+
# 2. (Optional) Edit instrux.json to customize defaults
|
|
107
|
+
|
|
108
|
+
# 3. Create more agents - they inherit repo defaults
|
|
109
|
+
instrux init AnotherAgent
|
|
110
|
+
|
|
111
|
+
# 4. Agent configs only need to specify what's unique
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Using a custom agents directory:**
|
|
115
|
+
|
|
116
|
+
To organize agents in a different location (e.g., `src/agents`):
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# 1. Create instrux.json first
|
|
120
|
+
instrux config:init
|
|
121
|
+
|
|
122
|
+
# 2. Edit instrux.json and change agentsDirectory
|
|
123
|
+
# {
|
|
124
|
+
# "agentsDirectory": "src/agents",
|
|
125
|
+
# ...
|
|
126
|
+
# }
|
|
127
|
+
|
|
128
|
+
# 3. Now create agents - they'll be in src/agents/
|
|
129
|
+
instrux init MyAgent
|
|
130
|
+
# Creates: src/agents/MyAgent/agent.json
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Config inheritance and precedence:**
|
|
134
|
+
|
|
135
|
+
Settings are merged in this order (later overrides earlier):
|
|
136
|
+
1. Built-in defaults (`DEFAULT_MERGE_SETTINGS`)
|
|
137
|
+
2. Repository config (`instrux.json`)
|
|
138
|
+
3. Agent config (`agents/<name>/agent.json`)
|
|
139
|
+
|
|
140
|
+
This means:
|
|
141
|
+
- If a setting is in the agent config, it's used
|
|
142
|
+
- Otherwise, if it's in the repo config, it's used
|
|
143
|
+
- Otherwise, the built-in default is used
|
|
144
|
+
|
|
145
|
+
You can make agent configs minimal by removing fields you want to inherit:
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"name": "MyAgent",
|
|
150
|
+
"description": "My agent",
|
|
151
|
+
"files": [...]
|
|
152
|
+
// outputDirectory inherited from instrux.json
|
|
153
|
+
// mergeSettings inherited from instrux.json
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
50
159
|
## Simple Mode (v1)
|
|
51
160
|
|
|
52
161
|
Files are merged in the order listed in `agent.json`:
|
|
@@ -269,6 +378,46 @@ const compiler = new InstruxCompiler(process.cwd(), config);
|
|
|
269
378
|
const { output, filesCompiled, tagsUsed } = await compiler.compile();
|
|
270
379
|
```
|
|
271
380
|
|
|
381
|
+
## Development
|
|
382
|
+
|
|
383
|
+
### Running Tests
|
|
384
|
+
|
|
385
|
+
This project uses Jest for testing:
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
# Run all tests
|
|
389
|
+
npm test
|
|
390
|
+
|
|
391
|
+
# Run tests in watch mode
|
|
392
|
+
npm run test:watch
|
|
393
|
+
|
|
394
|
+
# Run tests with coverage
|
|
395
|
+
npm run test:coverage
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Building
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
# Build TypeScript to JavaScript
|
|
402
|
+
npm run build
|
|
403
|
+
|
|
404
|
+
# Watch mode for development
|
|
405
|
+
npm run watch
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Project Structure
|
|
409
|
+
|
|
410
|
+
```
|
|
411
|
+
src/
|
|
412
|
+
cli.ts # CLI entry point
|
|
413
|
+
engine.ts # Core build engine
|
|
414
|
+
compiler.ts # Template compiler
|
|
415
|
+
init.ts # Scaffolding functions
|
|
416
|
+
frontmatter.ts # Frontmatter parsing
|
|
417
|
+
types.ts # TypeScript types
|
|
418
|
+
*.test.ts # Jest test files
|
|
419
|
+
```
|
|
420
|
+
|
|
272
421
|
## License
|
|
273
422
|
|
|
274
423
|
This project is dual-licensed under your choice of:
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG"}
|
package/dist/cli.js
CHANGED
|
@@ -5,16 +5,69 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Commands:
|
|
7
7
|
* instrux init <name> Scaffold a new agent
|
|
8
|
+
* instrux config:init Create repository-level config
|
|
8
9
|
* instrux build <name> Merge instruction files for an agent
|
|
9
10
|
* instrux build --all Build all agents
|
|
10
11
|
* instrux list List available agents
|
|
11
12
|
* instrux config <name> Show agent configuration
|
|
12
13
|
* instrux validate <name> Validate source files exist
|
|
13
14
|
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
+
}) : function(o, v) {
|
|
29
|
+
o["default"] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
32
|
+
var ownKeys = function(o) {
|
|
33
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34
|
+
var ar = [];
|
|
35
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36
|
+
return ar;
|
|
37
|
+
};
|
|
38
|
+
return ownKeys(o);
|
|
39
|
+
};
|
|
40
|
+
return function (mod) {
|
|
41
|
+
if (mod && mod.__esModule) return mod;
|
|
42
|
+
var result = {};
|
|
43
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
44
|
+
__setModuleDefault(result, mod);
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
14
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
49
|
const commander_1 = require("commander");
|
|
50
|
+
const path = __importStar(require("path"));
|
|
51
|
+
const fs = __importStar(require("fs-extra"));
|
|
16
52
|
const engine_1 = require("./engine");
|
|
17
53
|
const init_1 = require("./init");
|
|
54
|
+
/**
|
|
55
|
+
* Load repo config to get agentsDirectory for help text.
|
|
56
|
+
*/
|
|
57
|
+
async function getAgentsDir(rootDir) {
|
|
58
|
+
const configPath = path.join(rootDir, 'instrux.json');
|
|
59
|
+
if (await fs.pathExists(configPath)) {
|
|
60
|
+
try {
|
|
61
|
+
const raw = await fs.readFile(configPath, 'utf-8');
|
|
62
|
+
const config = JSON.parse(raw);
|
|
63
|
+
return config.agentsDirectory ?? 'agents';
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return 'agents';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return 'agents';
|
|
70
|
+
}
|
|
18
71
|
const pkg = require('../package.json');
|
|
19
72
|
const program = new commander_1.Command();
|
|
20
73
|
program
|
|
@@ -33,20 +86,26 @@ program
|
|
|
33
86
|
? await (0, init_1.initTemplateAgent)(cwd, name)
|
|
34
87
|
: await (0, init_1.initAgent)(cwd, name);
|
|
35
88
|
const mode = opts.template ? 'template' : 'simple';
|
|
89
|
+
const isFirstAgent = created.includes('instrux.json');
|
|
90
|
+
const agentsDir = await getAgentsDir(cwd);
|
|
36
91
|
console.log(`\n\u2705 Agent "${name}" initialized (${mode} mode)!\n`);
|
|
92
|
+
if (isFirstAgent) {
|
|
93
|
+
console.log('Created repository config (instrux.json) with default settings.');
|
|
94
|
+
console.log('This provides defaults for all agents in the project.\n');
|
|
95
|
+
}
|
|
37
96
|
console.log('Created:');
|
|
38
97
|
created.forEach(f => console.log(` ${f}`));
|
|
39
98
|
if (opts.template) {
|
|
40
99
|
console.log(`\nNext steps:`);
|
|
41
|
-
console.log(` 1. Edit
|
|
42
|
-
console.log(` 2. Edit
|
|
43
|
-
console.log(` 3. Edit
|
|
100
|
+
console.log(` 1. Edit ${agentsDir}/base/*.md to define shared instructions`);
|
|
101
|
+
console.log(` 2. Edit ${agentsDir}/${name}/domain.md with domain knowledge`);
|
|
102
|
+
console.log(` 3. Edit ${agentsDir}/${name}/template.md to compose via {{tag "..."}}`);
|
|
44
103
|
console.log(` 4. Run: instrux build ${name}\n`);
|
|
45
104
|
}
|
|
46
105
|
else {
|
|
47
106
|
console.log(`\nNext steps:`);
|
|
48
|
-
console.log(` 1. Edit
|
|
49
|
-
console.log(` 2. Edit
|
|
107
|
+
console.log(` 1. Edit ${agentsDir}/${name}/specialization.md with your instructions`);
|
|
108
|
+
console.log(` 2. Edit ${agentsDir}/${name}/agent.json to add more files if needed`);
|
|
50
109
|
console.log(` 3. Run: instrux build ${name}\n`);
|
|
51
110
|
}
|
|
52
111
|
}
|
|
@@ -55,6 +114,30 @@ program
|
|
|
55
114
|
process.exit(1);
|
|
56
115
|
}
|
|
57
116
|
});
|
|
117
|
+
// ── config:init ────────────────────────────────────────────
|
|
118
|
+
program
|
|
119
|
+
.command('config:init')
|
|
120
|
+
.description('Create a repository-level config file (instrux.json)')
|
|
121
|
+
.action(async () => {
|
|
122
|
+
try {
|
|
123
|
+
const cwd = process.cwd();
|
|
124
|
+
const created = await (0, init_1.initRepoConfig)(cwd);
|
|
125
|
+
console.log(`\n✅ Repository config created!\n`);
|
|
126
|
+
console.log(`Created: ${created}\n`);
|
|
127
|
+
console.log('This file provides default settings for all agents.');
|
|
128
|
+
console.log('Individual agent configs will inherit and can override these settings.\n');
|
|
129
|
+
console.log('Default settings:');
|
|
130
|
+
console.log(' - agentsDirectory: "agents"');
|
|
131
|
+
console.log(' - outputDirectory: "out"');
|
|
132
|
+
console.log(' - mergeSettings: standard defaults');
|
|
133
|
+
console.log(' - frontmatter: { output: "strip" }');
|
|
134
|
+
console.log(' - sources: ["agents/base/**/*.md"]\n');
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
console.error(`❌ ${err.message}`);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
58
141
|
// ── build ──────────────────────────────────────────────────
|
|
59
142
|
program
|
|
60
143
|
.command('build [name]')
|
|
@@ -109,10 +192,17 @@ program
|
|
|
109
192
|
console.log('\nAvailable agents:\n');
|
|
110
193
|
for (const agent of agents) {
|
|
111
194
|
if (agent.config) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
195
|
+
try {
|
|
196
|
+
// Load full resolved config to get all values with defaults
|
|
197
|
+
const resolved = await engine.loadConfig(agent.name);
|
|
198
|
+
const mode = resolved.entry ? 'template' : 'simple';
|
|
199
|
+
console.log(` ${agent.name} [${mode}]`);
|
|
200
|
+
console.log(` ${resolved.description}`);
|
|
201
|
+
console.log(` Files: ${resolved.files?.length ?? resolved.sources?.length ?? 0} \u2192 ${resolved.outputDirectory}/${resolved.outputFilePattern}`);
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
console.log(` ${agent.name} (error loading config)`);
|
|
205
|
+
}
|
|
116
206
|
}
|
|
117
207
|
else {
|
|
118
208
|
console.log(` ${agent.name} (invalid or missing agent.json)`);
|
|
@@ -140,9 +230,13 @@ program
|
|
|
140
230
|
});
|
|
141
231
|
console.log();
|
|
142
232
|
console.log(' Merge settings:');
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
});
|
|
233
|
+
const ms = config.mergeSettings;
|
|
234
|
+
console.log(` addSeparators: ${ms.addSeparators}`);
|
|
235
|
+
console.log(` separatorStyle: ${ms.separatorStyle}`);
|
|
236
|
+
console.log(` includeFileHeaders: ${ms.includeFileHeaders}`);
|
|
237
|
+
console.log(` preserveFormatting: ${ms.preserveFormatting}`);
|
|
238
|
+
console.log(` generateHash: ${ms.generateHash}`);
|
|
239
|
+
console.log(` useTimestamp: ${ms.useTimestamp}`);
|
|
146
240
|
console.log();
|
|
147
241
|
}
|
|
148
242
|
catch (err) {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAEA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAoC;AACpC,2CAA6B;AAC7B,6CAA+B;AAC/B,qCAAyC;AACzC,iCAAsE;AAGtE;;GAEG;AACH,KAAK,UAAU,YAAY,CAAC,OAAe;IACzC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACtD,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACpC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YACnD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAe,CAAC;YAC7C,OAAO,MAAM,CAAC,eAAe,IAAI,QAAQ,CAAC;QAC5C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,QA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AC;YACN,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;YACzC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;YACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,8DAA8D;AAE9D,SAAS,gBAAgB,CAAC,IAAY,EAAE,MAAW;IACjD,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,qBAAqB,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,cAAc,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,cAAc,MAAM,CAAC,aAAa,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,CAAC,cAAc,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,8DAA8D;AAE9D,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/compiler.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* 4. Cycle detection via a compile stack
|
|
12
12
|
* 5. Emit final output with optional frontmatter passthrough
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import { ResolvedAgentConfig } from './types';
|
|
15
15
|
export interface CompileResult {
|
|
16
16
|
/** Final compiled output (may include frontmatter block) */
|
|
17
17
|
output: string;
|
|
@@ -27,7 +27,7 @@ export declare class InstruxCompiler {
|
|
|
27
27
|
private compileStack;
|
|
28
28
|
private compiledFiles;
|
|
29
29
|
private tagsUsed;
|
|
30
|
-
constructor(rootDir: string, config:
|
|
30
|
+
constructor(rootDir: string, config: ResolvedAgentConfig);
|
|
31
31
|
compile(): Promise<CompileResult>;
|
|
32
32
|
private compileFile;
|
|
33
33
|
private registerHelpers;
|
package/dist/compiler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,EAEL,mBAAmB,EAIpB,MAAM,SAAS,CAAC;AAQjB,MAAM,WAAW,aAAa;IAC5B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,YAAY,CAA0B;IAC9C,OAAO,CAAC,aAAa,CAA0B;IAC/C,OAAO,CAAC,QAAQ,CAA0B;gBAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB;IAOlD,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC;IAgDvC,OAAO,CAAC,WAAW;IA+CnB,OAAO,CAAC,eAAe;CA2ExB"}
|
package/dist/compiler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,2CAA6B;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,OAAO,EAAE,CAAC,CAAC,OAAO;aACnB,CAAC,CAAC,CAAC;QACN,CAAC,CAAC,CAAC;QAEH;;;;WAIG;QACH,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,GAAW,EAAE,OAAY;YAC5D,OAAO,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAzLD,0CAyLC"}
|
package/dist/engine.d.ts
CHANGED
|
@@ -5,34 +5,47 @@
|
|
|
5
5
|
* - Simple merge: concatenates files in order (v1)
|
|
6
6
|
* - Compile: resolves Handlebars templates + frontmatter tags (v2)
|
|
7
7
|
*/
|
|
8
|
-
import { AgentConfig, BuildResult, ValidationResult } from './types';
|
|
8
|
+
import { AgentConfig, ResolvedAgentConfig, RepoConfig, BuildResult, ValidationResult } from './types';
|
|
9
9
|
export declare class InstruxEngine {
|
|
10
10
|
private rootDir;
|
|
11
|
+
private repoConfig;
|
|
11
12
|
constructor(rootDir?: string);
|
|
13
|
+
/**
|
|
14
|
+
* Load repository-level configuration from instrux.json at project root.
|
|
15
|
+
* This is cached after the first load.
|
|
16
|
+
*/
|
|
17
|
+
loadRepoConfig(): Promise<RepoConfig | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Merge repository config with agent config.
|
|
20
|
+
* Agent config takes precedence over repository config.
|
|
21
|
+
* Returns a config with all required fields populated.
|
|
22
|
+
*/
|
|
23
|
+
private mergeConfigs;
|
|
12
24
|
/**
|
|
13
25
|
* Resolve the config path for a given agent name.
|
|
14
|
-
* Looks in
|
|
26
|
+
* Looks in `<agentsDir>/<name>/agent.json`.
|
|
15
27
|
*/
|
|
16
28
|
private agentConfigPath;
|
|
17
29
|
/**
|
|
18
30
|
* Load an agent configuration by name.
|
|
31
|
+
* Merges with repository-level config if present.
|
|
19
32
|
*/
|
|
20
|
-
loadConfig(agentName: string): Promise<
|
|
33
|
+
loadConfig(agentName: string): Promise<ResolvedAgentConfig>;
|
|
21
34
|
/**
|
|
22
|
-
* List all agents found in the
|
|
35
|
+
* List all agents found in the configured agents directory.
|
|
23
36
|
*/
|
|
24
37
|
listAgents(): Promise<{
|
|
25
38
|
name: string;
|
|
26
39
|
config: AgentConfig | null;
|
|
27
40
|
}[]>;
|
|
28
|
-
validate(config:
|
|
29
|
-
merge(config:
|
|
30
|
-
writeOutput(config:
|
|
41
|
+
validate(config: ResolvedAgentConfig): Promise<ValidationResult>;
|
|
42
|
+
merge(config: ResolvedAgentConfig): Promise<string>;
|
|
43
|
+
writeOutput(config: ResolvedAgentConfig, content: string): Promise<string>;
|
|
31
44
|
/**
|
|
32
45
|
* Returns true if the agent config uses the template compiler (v2)
|
|
33
46
|
* instead of simple ordered merge.
|
|
34
47
|
*/
|
|
35
|
-
isCompileMode(config:
|
|
48
|
+
isCompileMode(config: ResolvedAgentConfig): boolean;
|
|
36
49
|
build(agentName: string): Promise<BuildResult>;
|
|
37
50
|
contentHash(content: string): string;
|
|
38
51
|
}
|
package/dist/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EACL,WAAW,EACX,WAAW,EACX,gBAAgB,
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AAGjB,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAA2B;gBAEjC,OAAO,CAAC,EAAE,MAAM;IAM5B;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAuBlD;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAoBpB;;;OAGG;YACW,eAAe;IAM7B;;;OAGG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAoBjE;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;KAAE,EAAE,CAAC;IAiCrE,QAAQ,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAqBhE,KAAK,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IA+CnD,WAAW,CAAC,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA4BhF;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO;IAI7C,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAgDpD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAOrC"}
|
package/dist/engine.js
CHANGED
|
@@ -44,37 +44,92 @@ exports.InstruxEngine = void 0;
|
|
|
44
44
|
const fs = __importStar(require("fs-extra"));
|
|
45
45
|
const path = __importStar(require("path"));
|
|
46
46
|
const crypto = __importStar(require("crypto"));
|
|
47
|
+
const types_1 = require("./types");
|
|
47
48
|
const compiler_1 = require("./compiler");
|
|
48
49
|
class InstruxEngine {
|
|
49
50
|
constructor(rootDir) {
|
|
51
|
+
this.repoConfig = null;
|
|
50
52
|
this.rootDir = rootDir ?? process.cwd();
|
|
51
53
|
}
|
|
54
|
+
// ── Repo config loading ───────────────────────
|
|
55
|
+
/**
|
|
56
|
+
* Load repository-level configuration from instrux.json at project root.
|
|
57
|
+
* This is cached after the first load.
|
|
58
|
+
*/
|
|
59
|
+
async loadRepoConfig() {
|
|
60
|
+
if (this.repoConfig !== null) {
|
|
61
|
+
return this.repoConfig;
|
|
62
|
+
}
|
|
63
|
+
const configPath = path.join(this.rootDir, 'instrux.json');
|
|
64
|
+
if (!(await fs.pathExists(configPath))) {
|
|
65
|
+
this.repoConfig = {};
|
|
66
|
+
return this.repoConfig;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const raw = await fs.readFile(configPath, 'utf-8');
|
|
70
|
+
this.repoConfig = JSON.parse(raw);
|
|
71
|
+
return this.repoConfig;
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
console.warn(`⚠ Warning: Failed to parse instrux.json: ${err}`);
|
|
75
|
+
this.repoConfig = {};
|
|
76
|
+
return this.repoConfig;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Merge repository config with agent config.
|
|
81
|
+
* Agent config takes precedence over repository config.
|
|
82
|
+
* Returns a config with all required fields populated.
|
|
83
|
+
*/
|
|
84
|
+
mergeConfigs(agentConfig, repoConfig) {
|
|
85
|
+
const mergeSettings = {
|
|
86
|
+
...types_1.DEFAULT_MERGE_SETTINGS,
|
|
87
|
+
...(repoConfig.mergeSettings ?? {}),
|
|
88
|
+
...(agentConfig.mergeSettings ?? {}),
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
...agentConfig,
|
|
92
|
+
agentsDirectory: repoConfig.agentsDirectory ?? 'agents',
|
|
93
|
+
outputDirectory: agentConfig.outputDirectory ?? repoConfig.outputDirectory ?? 'out',
|
|
94
|
+
outputFilePattern: agentConfig.outputFilePattern ?? `${agentConfig.name.toLowerCase()}_instructions.md`,
|
|
95
|
+
sources: agentConfig.sources ?? repoConfig.sources,
|
|
96
|
+
frontmatter: agentConfig.frontmatter ?? repoConfig.frontmatter,
|
|
97
|
+
mergeSettings,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
52
100
|
// ── Config loading ───────────────────────────────────────
|
|
53
101
|
/**
|
|
54
102
|
* Resolve the config path for a given agent name.
|
|
55
|
-
* Looks in
|
|
103
|
+
* Looks in `<agentsDir>/<name>/agent.json`.
|
|
56
104
|
*/
|
|
57
|
-
agentConfigPath(agentName) {
|
|
58
|
-
|
|
105
|
+
async agentConfigPath(agentName) {
|
|
106
|
+
const repoConfig = await this.loadRepoConfig();
|
|
107
|
+
const agentsDir = repoConfig?.agentsDirectory ?? 'agents';
|
|
108
|
+
return path.join(this.rootDir, agentsDir, agentName, 'agent.json');
|
|
59
109
|
}
|
|
60
110
|
/**
|
|
61
111
|
* Load an agent configuration by name.
|
|
112
|
+
* Merges with repository-level config if present.
|
|
62
113
|
*/
|
|
63
114
|
async loadConfig(agentName) {
|
|
64
|
-
const configPath = this.agentConfigPath(agentName);
|
|
115
|
+
const configPath = await this.agentConfigPath(agentName);
|
|
65
116
|
if (!(await fs.pathExists(configPath))) {
|
|
66
117
|
throw new Error(`Agent config not found: ${path.relative(this.rootDir, configPath)}\n` +
|
|
67
118
|
`Run "instrux init <name>" to create one.`);
|
|
68
119
|
}
|
|
69
120
|
const raw = await fs.readFile(configPath, 'utf-8');
|
|
70
|
-
|
|
121
|
+
const agentConfig = JSON.parse(raw);
|
|
122
|
+
// Load and merge repository config
|
|
123
|
+
const repoConfig = await this.loadRepoConfig();
|
|
124
|
+
return this.mergeConfigs(agentConfig, repoConfig ?? {});
|
|
71
125
|
}
|
|
72
126
|
// ── Discovery ────────────────────────────────────────────
|
|
73
127
|
/**
|
|
74
|
-
* List all agents found in the
|
|
128
|
+
* List all agents found in the configured agents directory.
|
|
75
129
|
*/
|
|
76
130
|
async listAgents() {
|
|
77
|
-
const
|
|
131
|
+
const repoConfig = await this.loadRepoConfig();
|
|
132
|
+
const agentsDir = path.join(this.rootDir, repoConfig?.agentsDirectory ?? 'agents');
|
|
78
133
|
if (!(await fs.pathExists(agentsDir))) {
|
|
79
134
|
return [];
|
|
80
135
|
}
|