@adhd/agent-engine-compiler 2.1.6 → 2.1.7
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/package.json +32 -10
- package/CHANGELOG.md +0 -19
- package/README.md +0 -72
- package/drizzle/meta/_journal.json +0 -5
- package/src/cache/composed-prompt-cache.d.ts +0 -60
- package/src/cache/composed-prompt-cache.d.ts.map +0 -1
- package/src/cache/composed-prompt-cache.js +0 -120
- package/src/cache/composed-prompt-cache.js.map +0 -1
- package/src/cli/compile.d.ts +0 -3
- package/src/cli/compile.d.ts.map +0 -1
- package/src/cli/compile.js +0 -300
- package/src/cli/compile.js.map +0 -1
- package/src/compile.d.ts +0 -61
- package/src/compile.d.ts.map +0 -1
- package/src/compile.js +0 -279
- package/src/compile.js.map +0 -1
- package/src/db/migrate-runner.d.ts +0 -31
- package/src/db/migrate-runner.d.ts.map +0 -1
- package/src/db/migrate-runner.js +0 -35
- package/src/db/migrate-runner.js.map +0 -1
- package/src/db/schema.d.ts +0 -3
- package/src/db/schema.d.ts.map +0 -1
- package/src/db/schema.js +0 -30
- package/src/db/schema.js.map +0 -1
- package/src/emit/json.d.ts +0 -50
- package/src/emit/json.d.ts.map +0 -1
- package/src/emit/json.js +0 -66
- package/src/emit/json.js.map +0 -1
- package/src/emit/markdown.d.ts +0 -35
- package/src/emit/markdown.d.ts.map +0 -1
- package/src/emit/markdown.js +0 -90
- package/src/emit/markdown.js.map +0 -1
- package/src/index.d.ts +0 -18
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -21
- package/src/index.js.map +0 -1
- package/src/resolve/composition.d.ts +0 -28
- package/src/resolve/composition.d.ts.map +0 -1
- package/src/resolve/composition.js +0 -33
- package/src/resolve/composition.js.map +0 -1
- package/src/resolve/model.d.ts +0 -22
- package/src/resolve/model.d.ts.map +0 -1
- package/src/resolve/model.js +0 -69
- package/src/resolve/model.js.map +0 -1
- package/src/resolve/policy.d.ts +0 -34
- package/src/resolve/policy.d.ts.map +0 -1
- package/src/resolve/policy.js +0 -44
- package/src/resolve/policy.js.map +0 -1
- package/src/resolve/tools.d.ts +0 -33
- package/src/resolve/tools.d.ts.map +0 -1
- package/src/resolve/tools.js +0 -62
- package/src/resolve/tools.js.map +0 -1
- package/src/seed/fixtures.d.ts +0 -52
- package/src/seed/fixtures.d.ts.map +0 -1
- package/src/seed/fixtures.js +0 -148
- package/src/seed/fixtures.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,28 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adhd/agent-engine-compiler",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"description": "Registry-family store for agent-compiler: drizzle-backed SQLite tables sharing the one registry database.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"CHANGELOG.md"
|
|
12
|
+
],
|
|
9
13
|
"bin": {
|
|
10
|
-
"agent-compiler": "src/cli/compile.js"
|
|
14
|
+
"agent-compiler": "./dist/src/cli/compile.js"
|
|
11
15
|
},
|
|
12
16
|
"exports": {
|
|
13
17
|
".": {
|
|
14
|
-
"types": "./src/index.d.ts",
|
|
15
|
-
"default": "./src/index.js"
|
|
18
|
+
"types": "./dist/src/index.d.ts",
|
|
19
|
+
"default": "./dist/src/index.js"
|
|
16
20
|
}
|
|
17
21
|
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "nx build agent-compiler",
|
|
24
|
+
"typecheck": "tsc -p tsconfig.lib.json --noEmit",
|
|
25
|
+
"db:generate": "drizzle-kit generate",
|
|
26
|
+
"db:migrate": "drizzle-kit migrate"
|
|
27
|
+
},
|
|
18
28
|
"dependencies": {
|
|
19
29
|
"better-sqlite3": "12.10.0",
|
|
20
30
|
"drizzle-orm": "0.45.2",
|
|
21
|
-
"@adhd/agent-store-prompts": "^2.1.
|
|
22
|
-
"@adhd/agent-store-tools": "^2.1.
|
|
23
|
-
"@adhd/agent-core-provider": "^2.1.
|
|
24
|
-
"@adhd/agent-core-policy": "^2.1.
|
|
25
|
-
"@adhd/agent-core-env": "^0.0.
|
|
31
|
+
"@adhd/agent-store-prompts": "^2.1.7",
|
|
32
|
+
"@adhd/agent-store-tools": "^2.1.9",
|
|
33
|
+
"@adhd/agent-core-provider": "^2.1.9",
|
|
34
|
+
"@adhd/agent-core-policy": "^2.1.9",
|
|
35
|
+
"@adhd/agent-core-env": "^0.0.7"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
39
|
+
"@vitest/coverage-v8": "^1.0.4",
|
|
40
|
+
"drizzle-kit": "^0.31.10",
|
|
41
|
+
"tslib": "^2.6.0",
|
|
42
|
+
"typescript": "^5.5.0",
|
|
43
|
+
"vite": "~5.0.13",
|
|
44
|
+
"vite-plugin-dts": "~3.8.3",
|
|
45
|
+
"vitest": "^1.6.0"
|
|
26
46
|
},
|
|
27
47
|
"license": "MIT",
|
|
28
48
|
"repository": {
|
|
@@ -33,5 +53,7 @@
|
|
|
33
53
|
"homepage": "https://github.com/PseudoSky/adhd/tree/main/packages/agent/agent-engine-compiler#readme",
|
|
34
54
|
"bugs": {
|
|
35
55
|
"url": "https://github.com/PseudoSky/adhd/issues"
|
|
36
|
-
}
|
|
56
|
+
},
|
|
57
|
+
"module": "./src/index.js",
|
|
58
|
+
"main": "./src/index.js"
|
|
37
59
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
## 2.1.5 (2026-07-24)
|
|
2
|
-
|
|
3
|
-
This was a version bump only for agent-engine-compiler to align it with other projects, there were no code changes.
|
|
4
|
-
|
|
5
|
-
## 2.1.4 (2026-07-24)
|
|
6
|
-
|
|
7
|
-
This was a version bump only for agent-engine-compiler to align it with other projects, there were no code changes.
|
|
8
|
-
|
|
9
|
-
## 2.1.3 (2026-07-23)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
### 🚀 Features
|
|
13
|
-
|
|
14
|
-
- **agent-core-env:** shared registry-DB resolver + DI kills import-time DB-open side effect
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
### ❤️ Thank You
|
|
18
|
-
|
|
19
|
-
- pseudosky
|
package/README.md
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# @adhd/agent-engine-compiler
|
|
2
|
-
|
|
3
|
-
Compiles agent configurations from the registry into runtime-ready manifests. Resolves component compositions, tool bindings, policy constraints, and model specifications. Part of the agent registry family.
|
|
4
|
-
|
|
5
|
-
**Status:** Shipped v2.1.2
|
|
6
|
-
**Platform:** `platform:node` (runs in Node/CLI, not browser)
|
|
7
|
-
**Consumers:** `@adhd/agent-mcp`, `@adhd/dispatch-cli`
|
|
8
|
-
|
|
9
|
-
## What it does
|
|
10
|
-
|
|
11
|
-
- **Body Resolution** — Assembles agent components from the registry composition store into a complete prompt body
|
|
12
|
-
- **Tool Resolution** — Resolves tool aliases and platform-specific bindings (HTTP, MCP, CLI, etc.)
|
|
13
|
-
- **Model Resolution** — Looks up model capabilities and configurations
|
|
14
|
-
- **Policy Constraint Resolution** — Evaluates effective authorization policies
|
|
15
|
-
- **Output Emission** — Compiles agent definitions into YAML frontmatter, JSON objects, or Markdown documents
|
|
16
|
-
- **Database Migrations** — Runs schema setup via `runMigrationsOn(db)`
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
|
|
20
|
-
First, resolve the shared registry database path:
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
import { resolveRegistryDbPath } from '@adhd/agent-core-env';
|
|
24
|
-
import Database from 'better-sqlite3';
|
|
25
|
-
import { runMigrationsOn, compileAgent } from '@adhd/agent-engine-compiler';
|
|
26
|
-
|
|
27
|
-
const dbPath = resolveRegistryDbPath(); // e.g., ~/.adhd/agent-registry/production/data/registry.db
|
|
28
|
-
const db = new Database(dbPath);
|
|
29
|
-
|
|
30
|
-
// Run migrations
|
|
31
|
-
await runMigrationsOn(db);
|
|
32
|
-
|
|
33
|
-
// Compile an agent from the registry
|
|
34
|
-
const compiled = await compileAgent(db, {
|
|
35
|
-
agentId: 'my-agent',
|
|
36
|
-
platform: 'mcp', // or 'http', 'cli', 'json'
|
|
37
|
-
models: modelStore,
|
|
38
|
-
tools: toolStore,
|
|
39
|
-
policies: policyStore,
|
|
40
|
-
composition: compositionStore,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// Emit as YAML or JSON
|
|
44
|
-
const yaml = emitYamlFrontmatter({
|
|
45
|
-
agentId: compiled.agentId,
|
|
46
|
-
tools: compiled.tools,
|
|
47
|
-
modelAlias: compiled.modelAlias,
|
|
48
|
-
policyConstraints: compiled.policyConstraints,
|
|
49
|
-
});
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Key exports
|
|
53
|
-
|
|
54
|
-
| Export | Purpose |
|
|
55
|
-
|--------|---------|
|
|
56
|
-
| `resolveBody(db, ...)` | Assemble component composition into prompt body |
|
|
57
|
-
| `resolveTools(db, ...)` | Resolve tools and platform bindings |
|
|
58
|
-
| `resolveModel(db, ...)` | Look up model and capabilities |
|
|
59
|
-
| `resolvePolicyConstraints(db, ...)` | Resolve effective policies |
|
|
60
|
-
| `compileAgent(db, input)` | Complete compilation orchestrator |
|
|
61
|
-
| `emitYamlFrontmatter(input)` | Emit as YAML frontmatter + body |
|
|
62
|
-
| `emitJsonObject(input)` | Emit as JSON (e.g., for REST API) |
|
|
63
|
-
| `runMigrationsOn(db)` | Initialize database schema |
|
|
64
|
-
|
|
65
|
-
## Architecture
|
|
66
|
-
|
|
67
|
-
- **Tier**: `engine` (depends on base + core + stores)
|
|
68
|
-
- **Consumption**: Reads from all registry family stores (prompts, tools, policy, provider)
|
|
69
|
-
- **No import-time side effects** — DB path and connection are external (via `agent-core-env`)
|
|
70
|
-
- **Part of agent registry family**: `agent-store-prompts` + `agent-store-tools` + `agent-core-policy` + `agent-core-provider` + `agent-engine-compiler`
|
|
71
|
-
|
|
72
|
-
See `/entrypoint/agent-mcp/` for the agent MCP server (primary consumer).
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
2
|
-
import type { ComposedPrompt } from '@adhd/agent-store-prompts';
|
|
3
|
-
import type { ComponentVersionMap } from '../resolve/composition.js';
|
|
4
|
-
/**
|
|
5
|
-
* Compute the combined `context_hash` for the `registry_composed_prompts` cache.
|
|
6
|
-
*
|
|
7
|
-
* Decision D (decisions.md): `context_hash = SHA-256(sortedJSON(context) + " " +
|
|
8
|
-
* sortedJSON(componentVersions) + " " + platform)`.
|
|
9
|
-
*
|
|
10
|
-
* The `registryContextHash` (from @adhd/agent-registry) handles sorted-key JSON
|
|
11
|
-
* canonicalization of the context part. We apply the same sorted-key approach to
|
|
12
|
-
* `componentVersions` and append the `platform` string as a third field so that any
|
|
13
|
-
* of the three inputs changing produces a distinct hash.
|
|
14
|
-
*
|
|
15
|
-
* A ` ` (space) field separator is used between parts — plain JSON can never contain
|
|
16
|
-
* an unescaped space at the top level, so the three blobs cannot collide by
|
|
17
|
-
* concatenation.
|
|
18
|
-
*
|
|
19
|
-
* @param context - Runtime context key/value map (e.g. `{ticket_type:"security"}`).
|
|
20
|
-
* @param componentVersions - Resolved component-version map from `resolveComposition`.
|
|
21
|
-
* @param platform - Target platform id (e.g. `claude_code`, `claude_api`).
|
|
22
|
-
* @returns 64-character lowercase hex SHA-256 string.
|
|
23
|
-
*/
|
|
24
|
-
export declare function computeContextHash(context: Record<string, string>, componentVersions: ComponentVersionMap, platform: string): string;
|
|
25
|
-
/**
|
|
26
|
-
* Look up a `registry_composed_prompts` row by `(agentSlug, platform, context_hash)`.
|
|
27
|
-
*
|
|
28
|
-
* The `context_hash` encodes `(context, componentVersions, platform)` per Decision D.
|
|
29
|
-
* Returns the cached row (with its `id`) on a HIT, or `null` on a MISS.
|
|
30
|
-
*
|
|
31
|
-
* A cache hit means `compileAgent` can return the persisted `{id, content}` WITHOUT
|
|
32
|
-
* re-running the resolve layers (the assembly step is bypassed). This is the
|
|
33
|
-
* `[dod.4]` negative-control guarantee: removing this SELECT before assembly causes
|
|
34
|
-
* a duplicate row on every compile.
|
|
35
|
-
*
|
|
36
|
-
* @param db - Shared Drizzle handle (all four table prefixes).
|
|
37
|
-
* @param agentSlug - Agent to look up.
|
|
38
|
-
* @param platform - Target platform id.
|
|
39
|
-
* @param context - Runtime context key/value map.
|
|
40
|
-
* @param componentVersions - Resolved component-version map from `resolveComposition`.
|
|
41
|
-
* @returns The cached `ComposedPrompt` row on a HIT, or `null` on a MISS.
|
|
42
|
-
*/
|
|
43
|
-
export declare function lookup(db: BetterSQLite3Database<any>, agentSlug: string, platform: string, context: Record<string, string>, componentVersions: ComponentVersionMap): ComposedPrompt | null;
|
|
44
|
-
/**
|
|
45
|
-
* Write a new `registry_composed_prompts` row for `(agentSlug, platform, context_hash)`.
|
|
46
|
-
*
|
|
47
|
-
* Called on a cache MISS: after assembly is complete, persists the composed prompt
|
|
48
|
-
* so subsequent compiles can hit the cache. Returns the inserted row, including the
|
|
49
|
-
* generated `id` (the [def:composed-output].id audit/cache handle).
|
|
50
|
-
*
|
|
51
|
-
* @param db - Shared Drizzle handle (all four table prefixes).
|
|
52
|
-
* @param agentSlug - Agent the row belongs to.
|
|
53
|
-
* @param platform - Target platform id (folded into the hash).
|
|
54
|
-
* @param context - Runtime context key/value map used for assembly.
|
|
55
|
-
* @param componentVersions - Resolved component-version map (audit trail).
|
|
56
|
-
* @param content - The assembled platform artifact (markdown, JSON, etc.).
|
|
57
|
-
* @returns The inserted `ComposedPrompt` row with its generated `id`.
|
|
58
|
-
*/
|
|
59
|
-
export declare function write(db: BetterSQLite3Database<any>, agentSlug: string, platform: string, context: Record<string, string>, componentVersions: ComponentVersionMap, content: string): ComposedPrompt;
|
|
60
|
-
//# sourceMappingURL=composed-prompt-cache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composed-prompt-cache.d.ts","sourceRoot":"","sources":["../../../src/cache/composed-prompt-cache.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAMxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAMrE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,iBAAiB,EAAE,mBAAmB,EACtC,QAAQ,EAAE,MAAM,GACf,MAAM,CAiBR;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAEpB,EAAE,EAAE,qBAAqB,CAAC,GAAG,CAAC,EAC9B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,iBAAiB,EAAE,mBAAmB,GACrC,cAAc,GAAG,IAAI,CAIvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAEnB,EAAE,EAAE,qBAAqB,CAAC,GAAG,CAAC,EAC9B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,iBAAiB,EAAE,mBAAmB,EACtC,OAAO,EAAE,MAAM,GACd,cAAc,CAShB"}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
// ──────────────────────────────────────────────
|
|
2
|
-
// composed-prompt-cache — cache lookup + write for the composed_prompts table.
|
|
3
|
-
//
|
|
4
|
-
// Implements Decision D (decisions.md [def:context-hash]):
|
|
5
|
-
// context_hash = SHA-256( sortedJSON(context) + " " + sortedJSON(componentVersions) + " " + platform )
|
|
6
|
-
//
|
|
7
|
-
// The three-part key encodes:
|
|
8
|
-
// 1. The runtime context (any key/value change → different hash → cache miss).
|
|
9
|
-
// 2. The resolved component-version set (an unpinned component advancing to a
|
|
10
|
-
// new latest → different componentVersions → miss).
|
|
11
|
-
// 3. The target platform (different platform → different content shape → miss).
|
|
12
|
-
//
|
|
13
|
-
// The "context part" reuses @adhd/agent-registry's exported `contextHash` helper
|
|
14
|
-
// for consistent sorted-key JSON canonicalization — do NOT reimplement
|
|
15
|
-
// ([ref:store-read], decisions.md Decision D note).
|
|
16
|
-
//
|
|
17
|
-
// The composed_prompts table comes from @adhd/agent-registry (plan 1,
|
|
18
|
-
// `registry_composed_prompts`). We use the existing table via the shared DB
|
|
19
|
-
// handle passed by `compileAgent` ([inv:one-db-handle]). No duplicate table
|
|
20
|
-
// is created here.
|
|
21
|
-
//
|
|
22
|
-
// [def:context-hash] — the combined cache key algorithm (decisions.md Decision D)
|
|
23
|
-
// [inv:one-db-handle] — shared Drizzle handle, all four table prefixes
|
|
24
|
-
// [inv:reopen-proves-cache] — persistence proven by CLOSE+REOPEN (test invariant)
|
|
25
|
-
// ──────────────────────────────────────────────
|
|
26
|
-
import { createHash } from 'node:crypto';
|
|
27
|
-
import { ComposedPromptStore, contextHash as registryContextHash, } from '@adhd/agent-store-prompts';
|
|
28
|
-
// ──────────────────────────────────────────────
|
|
29
|
-
// Combined cache-key hash
|
|
30
|
-
// ──────────────────────────────────────────────
|
|
31
|
-
/**
|
|
32
|
-
* Compute the combined `context_hash` for the `registry_composed_prompts` cache.
|
|
33
|
-
*
|
|
34
|
-
* Decision D (decisions.md): `context_hash = SHA-256(sortedJSON(context) + " " +
|
|
35
|
-
* sortedJSON(componentVersions) + " " + platform)`.
|
|
36
|
-
*
|
|
37
|
-
* The `registryContextHash` (from @adhd/agent-registry) handles sorted-key JSON
|
|
38
|
-
* canonicalization of the context part. We apply the same sorted-key approach to
|
|
39
|
-
* `componentVersions` and append the `platform` string as a third field so that any
|
|
40
|
-
* of the three inputs changing produces a distinct hash.
|
|
41
|
-
*
|
|
42
|
-
* A ` ` (space) field separator is used between parts — plain JSON can never contain
|
|
43
|
-
* an unescaped space at the top level, so the three blobs cannot collide by
|
|
44
|
-
* concatenation.
|
|
45
|
-
*
|
|
46
|
-
* @param context - Runtime context key/value map (e.g. `{ticket_type:"security"}`).
|
|
47
|
-
* @param componentVersions - Resolved component-version map from `resolveComposition`.
|
|
48
|
-
* @param platform - Target platform id (e.g. `claude_code`, `claude_api`).
|
|
49
|
-
* @returns 64-character lowercase hex SHA-256 string.
|
|
50
|
-
*/
|
|
51
|
-
export function computeContextHash(context, componentVersions, platform) {
|
|
52
|
-
// Part 1: sorted-key JSON of context (reuse the upstream helper for parity).
|
|
53
|
-
const contextPart = registryContextHash(context);
|
|
54
|
-
// Part 2: sorted-key JSON of componentVersions (apply the same canonicalization).
|
|
55
|
-
const sortedVersions = Object.fromEntries(Object.keys(componentVersions)
|
|
56
|
-
.sort()
|
|
57
|
-
.map((k) => [k, componentVersions[k]]));
|
|
58
|
-
const versionPart = JSON.stringify(sortedVersions);
|
|
59
|
-
// Combined: context_hash(context) + " " + sortedJSON(componentVersions) + " " + platform
|
|
60
|
-
// Field separator is a bare space — JSON strings never contain unescaped spaces
|
|
61
|
-
// at the outermost level, so the three segments cannot collide.
|
|
62
|
-
const combined = `${contextPart} ${versionPart} ${platform}`;
|
|
63
|
-
return createHash('sha256').update(combined, 'utf8').digest('hex');
|
|
64
|
-
}
|
|
65
|
-
// ──────────────────────────────────────────────
|
|
66
|
-
// Cache operations
|
|
67
|
-
// ──────────────────────────────────────────────
|
|
68
|
-
/**
|
|
69
|
-
* Look up a `registry_composed_prompts` row by `(agentSlug, platform, context_hash)`.
|
|
70
|
-
*
|
|
71
|
-
* The `context_hash` encodes `(context, componentVersions, platform)` per Decision D.
|
|
72
|
-
* Returns the cached row (with its `id`) on a HIT, or `null` on a MISS.
|
|
73
|
-
*
|
|
74
|
-
* A cache hit means `compileAgent` can return the persisted `{id, content}` WITHOUT
|
|
75
|
-
* re-running the resolve layers (the assembly step is bypassed). This is the
|
|
76
|
-
* `[dod.4]` negative-control guarantee: removing this SELECT before assembly causes
|
|
77
|
-
* a duplicate row on every compile.
|
|
78
|
-
*
|
|
79
|
-
* @param db - Shared Drizzle handle (all four table prefixes).
|
|
80
|
-
* @param agentSlug - Agent to look up.
|
|
81
|
-
* @param platform - Target platform id.
|
|
82
|
-
* @param context - Runtime context key/value map.
|
|
83
|
-
* @param componentVersions - Resolved component-version map from `resolveComposition`.
|
|
84
|
-
* @returns The cached `ComposedPrompt` row on a HIT, or `null` on a MISS.
|
|
85
|
-
*/
|
|
86
|
-
export function lookup(
|
|
87
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
88
|
-
db, agentSlug, platform, context, componentVersions) {
|
|
89
|
-
const hash = computeContextHash(context, componentVersions, platform);
|
|
90
|
-
const store = new ComposedPromptStore(db);
|
|
91
|
-
return store.lookup(agentSlug, hash);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Write a new `registry_composed_prompts` row for `(agentSlug, platform, context_hash)`.
|
|
95
|
-
*
|
|
96
|
-
* Called on a cache MISS: after assembly is complete, persists the composed prompt
|
|
97
|
-
* so subsequent compiles can hit the cache. Returns the inserted row, including the
|
|
98
|
-
* generated `id` (the [def:composed-output].id audit/cache handle).
|
|
99
|
-
*
|
|
100
|
-
* @param db - Shared Drizzle handle (all four table prefixes).
|
|
101
|
-
* @param agentSlug - Agent the row belongs to.
|
|
102
|
-
* @param platform - Target platform id (folded into the hash).
|
|
103
|
-
* @param context - Runtime context key/value map used for assembly.
|
|
104
|
-
* @param componentVersions - Resolved component-version map (audit trail).
|
|
105
|
-
* @param content - The assembled platform artifact (markdown, JSON, etc.).
|
|
106
|
-
* @returns The inserted `ComposedPrompt` row with its generated `id`.
|
|
107
|
-
*/
|
|
108
|
-
export function write(
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
|
-
db, agentSlug, platform, context, componentVersions, content) {
|
|
111
|
-
const hash = computeContextHash(context, componentVersions, platform);
|
|
112
|
-
const store = new ComposedPromptStore(db);
|
|
113
|
-
return store.write({
|
|
114
|
-
agentSlug,
|
|
115
|
-
contextHash: hash,
|
|
116
|
-
content,
|
|
117
|
-
componentVersions,
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
//# sourceMappingURL=composed-prompt-cache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composed-prompt-cache.js","sourceRoot":"","sources":["../../../src/cache/composed-prompt-cache.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,+EAA+E;AAC/E,EAAE;AACF,2DAA2D;AAC3D,yGAAyG;AACzG,EAAE;AACF,8BAA8B;AAC9B,iFAAiF;AACjF,gFAAgF;AAChF,yDAAyD;AACzD,kFAAkF;AAClF,EAAE;AACF,iFAAiF;AACjF,uEAAuE;AACvE,oDAAoD;AACpD,EAAE;AACF,sEAAsE;AACtE,6EAA6E;AAC7E,6EAA6E;AAC7E,mBAAmB;AACnB,EAAE;AACF,qFAAqF;AACrF,yEAAyE;AACzE,kFAAkF;AAClF,iDAAiD;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EACL,mBAAmB,EACnB,WAAW,IAAI,mBAAmB,GACnC,MAAM,2BAA2B,CAAC;AAInC,iDAAiD;AACjD,0BAA0B;AAC1B,iDAAiD;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAA+B,EAC/B,iBAAsC,EACtC,QAAgB;IAEhB,6EAA6E;IAC7E,MAAM,WAAW,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAEjD,kFAAkF;IAClF,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CACvC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC;SAC3B,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAU,CAAC,CAClD,CAAC;IACF,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAEnD,yFAAyF;IACzF,gFAAgF;IAChF,gEAAgE;IAChE,MAAM,QAAQ,GAAG,GAAG,WAAW,IAAI,WAAW,IAAI,QAAQ,EAAE,CAAC;IAC7D,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC;AAED,iDAAiD;AACjD,mBAAmB;AACnB,iDAAiD;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,MAAM;AACpB,8DAA8D;AAC9D,EAA8B,EAC9B,SAAiB,EACjB,QAAgB,EAChB,OAA+B,EAC/B,iBAAsC;IAEtC,MAAM,IAAI,GAAG,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,CAAC,CAAC;IACtE,MAAM,KAAK,GAAG,IAAI,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAC1C,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,KAAK;AACnB,8DAA8D;AAC9D,EAA8B,EAC9B,SAAiB,EACjB,QAAgB,EAChB,OAA+B,EAC/B,iBAAsC,EACtC,OAAe;IAEf,MAAM,IAAI,GAAG,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,CAAC,CAAC;IACtE,MAAM,KAAK,GAAG,IAAI,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAC1C,OAAO,KAAK,CAAC,KAAK,CAAC;QACjB,SAAS;QACT,WAAW,EAAE,IAAI;QACjB,OAAO;QACP,iBAAiB;KAClB,CAAC,CAAC;AACL,CAAC"}
|
package/src/cli/compile.d.ts
DELETED
package/src/cli/compile.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/compile.ts"],"names":[],"mappings":""}
|
package/src/cli/compile.js
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// ──────────────────────────────────────────────
|
|
3
|
-
// cli/compile.ts — argv parser + dispatcher for the agent-compiler bin.
|
|
4
|
-
//
|
|
5
|
-
// Usage:
|
|
6
|
-
// node cli/compile.js compile <slug> [options]
|
|
7
|
-
//
|
|
8
|
-
// Options:
|
|
9
|
-
// --platform <p> Target platform (default: claude_code).
|
|
10
|
-
// Must match a row in tool_platforms.
|
|
11
|
-
// --context '<json>' Runtime context key/value object (JSON string).
|
|
12
|
-
// --format json Emit JSON instead of platform default.
|
|
13
|
-
// --out-dir <d> Write <slug>.md (or <slug>.json) under <d>
|
|
14
|
-
// instead of printing to stdout.
|
|
15
|
-
// --all Compile every agent in the registry (use with
|
|
16
|
-
// --category to limit scope).
|
|
17
|
-
// --category <c> Filter to agents in this taxonomy category slug.
|
|
18
|
-
// --db <path> Path to the SQLite registry file. Defaults to
|
|
19
|
-
// AGENT_REGISTRY_DB env var, then ~/.agent-registry/registry.db.
|
|
20
|
-
//
|
|
21
|
-
// Exit codes:
|
|
22
|
-
// 0 — success
|
|
23
|
-
// 1 — unknown slug / unknown platform / bad argument / I/O error
|
|
24
|
-
//
|
|
25
|
-
// [ref:cli-bin] — mirrors agent-mcp's bin entry in package.json;
|
|
26
|
-
// parses compile <slug> ... and writes content to stdout or --out-dir.
|
|
27
|
-
// [inv:platform-node] — no browser imports; pure Node + SQLite.
|
|
28
|
-
// [inv:one-db-handle] — opens ONE better-sqlite3 handle for the shared DB.
|
|
29
|
-
// ──────────────────────────────────────────────
|
|
30
|
-
import fs from 'node:fs';
|
|
31
|
-
import path from 'node:path';
|
|
32
|
-
import process from 'node:process';
|
|
33
|
-
import { fileURLToPath } from 'node:url';
|
|
34
|
-
import Database from 'better-sqlite3';
|
|
35
|
-
import { drizzle } from 'drizzle-orm/better-sqlite3';
|
|
36
|
-
import { migrate } from 'drizzle-orm/better-sqlite3/migrator';
|
|
37
|
-
import { resolveRegistryDbPath } from '@adhd/agent-core-env';
|
|
38
|
-
import { AgentStore } from '@adhd/agent-store-prompts';
|
|
39
|
-
import { compileAgent } from '../compile.js';
|
|
40
|
-
// ── Migration folders ─────────────────────────────────────────────────────
|
|
41
|
-
//
|
|
42
|
-
// Resolved relative to this compiled file's __dirname at runtime so the bin
|
|
43
|
-
// works from the dist layout without referencing source paths.
|
|
44
|
-
//
|
|
45
|
-
// dist/packages/agent/agent-engine-compiler/src/cli/compile.js
|
|
46
|
-
// → ../../ = dist/packages/agent/agent-engine-compiler/
|
|
47
|
-
// → ../../../ = dist/packages/agent/
|
|
48
|
-
// → ../../../<pkg>/drizzle = dist/packages/agent/<pkg>/drizzle
|
|
49
|
-
//
|
|
50
|
-
// Timestamp order (ascending) matters so Drizzle's journal bookkeeping
|
|
51
|
-
// doesn't skip a migration set:
|
|
52
|
-
// provider (1750*) → registry (1782193*) → tool-registry (1782250*)
|
|
53
|
-
// → policy (1782256*) → compiler (18*)
|
|
54
|
-
//
|
|
55
|
-
// This mirrors the migration order in compile-agent.test.ts.
|
|
56
|
-
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
57
|
-
const AI_DIST = path.resolve(__dirname, '../../../');
|
|
58
|
-
const PROVIDER_MIGRATIONS = path.join(AI_DIST, 'agent-core-provider/drizzle');
|
|
59
|
-
const REGISTRY_MIGRATIONS = path.join(AI_DIST, 'agent-store-prompts/drizzle');
|
|
60
|
-
const TOOL_REGISTRY_MIGRATIONS = path.join(AI_DIST, 'agent-store-tools/drizzle');
|
|
61
|
-
const POLICY_MIGRATIONS = path.join(AI_DIST, 'agent-core-policy/drizzle');
|
|
62
|
-
const COMPILER_MIGRATIONS = path.join(AI_DIST, 'agent-engine-compiler/drizzle');
|
|
63
|
-
// ──────────────────────────────────────────────
|
|
64
|
-
// argv parser
|
|
65
|
-
// ──────────────────────────────────────────────
|
|
66
|
-
/**
|
|
67
|
-
* Parse process.argv into a CliArgs object.
|
|
68
|
-
* Exits 1 with a usage message on any parse error.
|
|
69
|
-
*/
|
|
70
|
-
function parseArgs(argv) {
|
|
71
|
-
// argv: [ node, compile.js, 'compile', <slug?>, ...flags ]
|
|
72
|
-
const args = argv.slice(2); // strip node + script path
|
|
73
|
-
if (args[0] !== 'compile') {
|
|
74
|
-
die(`Expected sub-command 'compile', got: ${args[0] ?? '(nothing)'}`);
|
|
75
|
-
}
|
|
76
|
-
let slug = null;
|
|
77
|
-
let platform = 'claude_code';
|
|
78
|
-
let context = {};
|
|
79
|
-
let formatJson = false;
|
|
80
|
-
let outDir = null;
|
|
81
|
-
let all = false;
|
|
82
|
-
let category = null;
|
|
83
|
-
// AGENT_REGISTRY_DB is this CLI's own pre-existing, bin-specific legacy
|
|
84
|
-
// override (kept for back-compat) — it wins over the shared resolver's
|
|
85
|
-
// canonical default but not over an explicit --db flag (applied below).
|
|
86
|
-
// resolveRegistryDbPath() itself still checks the 3 documented
|
|
87
|
-
// registry-family env vars (ADHD_AGENT_REGISTRY_DB_PATH,
|
|
88
|
-
// REGISTRY_DATABASE_PATH, DATABASE_PATH) before falling back to the
|
|
89
|
-
// @adhd/environment-resolved canonical default.
|
|
90
|
-
let dbPath = process.env['AGENT_REGISTRY_DB'] ?? resolveRegistryDbPath();
|
|
91
|
-
const flags = args.slice(1); // everything after 'compile'
|
|
92
|
-
let i = 0;
|
|
93
|
-
while (i < flags.length) {
|
|
94
|
-
const tok = flags[i];
|
|
95
|
-
if (tok === '--platform') {
|
|
96
|
-
platform = requireNext(flags, i, '--platform');
|
|
97
|
-
i += 2;
|
|
98
|
-
}
|
|
99
|
-
else if (tok === '--context') {
|
|
100
|
-
const raw = requireNext(flags, i, '--context');
|
|
101
|
-
try {
|
|
102
|
-
// Parse as unknown first, then cast to CompositionContext (Record<string, string>).
|
|
103
|
-
// The runtime contract is that --context values are string-keyed, string-valued.
|
|
104
|
-
context = JSON.parse(raw);
|
|
105
|
-
}
|
|
106
|
-
catch {
|
|
107
|
-
die(`--context must be valid JSON; got: ${raw}`);
|
|
108
|
-
}
|
|
109
|
-
i += 2;
|
|
110
|
-
}
|
|
111
|
-
else if (tok === '--format') {
|
|
112
|
-
const fmt = requireNext(flags, i, '--format');
|
|
113
|
-
if (fmt !== 'json') {
|
|
114
|
-
die(`--format only supports 'json'; got: '${fmt}'`);
|
|
115
|
-
}
|
|
116
|
-
formatJson = true;
|
|
117
|
-
i += 2;
|
|
118
|
-
}
|
|
119
|
-
else if (tok === '--out-dir') {
|
|
120
|
-
outDir = requireNext(flags, i, '--out-dir');
|
|
121
|
-
i += 2;
|
|
122
|
-
}
|
|
123
|
-
else if (tok === '--all') {
|
|
124
|
-
all = true;
|
|
125
|
-
i++;
|
|
126
|
-
}
|
|
127
|
-
else if (tok === '--category') {
|
|
128
|
-
category = requireNext(flags, i, '--category');
|
|
129
|
-
i += 2;
|
|
130
|
-
}
|
|
131
|
-
else if (tok === '--db') {
|
|
132
|
-
dbPath = requireNext(flags, i, '--db');
|
|
133
|
-
i += 2;
|
|
134
|
-
}
|
|
135
|
-
else if (tok != null && !tok.startsWith('-')) {
|
|
136
|
-
// Positional slug — only accepted once.
|
|
137
|
-
if (slug !== null) {
|
|
138
|
-
die(`Unexpected extra positional argument: '${tok}'`);
|
|
139
|
-
}
|
|
140
|
-
slug = tok;
|
|
141
|
-
i++;
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
die(`Unknown flag: '${tok}'`);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
if (!all && slug === null) {
|
|
148
|
-
die('Provide a slug (compile <slug>) or use --all [--category <c>]');
|
|
149
|
-
}
|
|
150
|
-
if (all && slug !== null) {
|
|
151
|
-
die('--all and a positional slug are mutually exclusive');
|
|
152
|
-
}
|
|
153
|
-
return { slug, platform, context, formatJson, outDir, all, category, dbPath };
|
|
154
|
-
}
|
|
155
|
-
function requireNext(flags, i, flag) {
|
|
156
|
-
const val = flags[i + 1];
|
|
157
|
-
if (val == null || val.startsWith('-')) {
|
|
158
|
-
die(`${flag} requires a value`);
|
|
159
|
-
}
|
|
160
|
-
return val;
|
|
161
|
-
}
|
|
162
|
-
// ──────────────────────────────────────────────
|
|
163
|
-
// DB open helper
|
|
164
|
-
// ──────────────────────────────────────────────
|
|
165
|
-
/**
|
|
166
|
-
* Open the shared SQLite registry file and apply migrations so the schema is
|
|
167
|
-
* always current ([inv:one-db-handle]).
|
|
168
|
-
*
|
|
169
|
-
* Runs all five migration sets in ascending timestamp order so Drizzle's
|
|
170
|
-
* journal does not skip any set.
|
|
171
|
-
*/
|
|
172
|
-
function openDb(dbPath) {
|
|
173
|
-
if (!fs.existsSync(dbPath)) {
|
|
174
|
-
const parent = path.dirname(dbPath);
|
|
175
|
-
if (!fs.existsSync(parent)) {
|
|
176
|
-
fs.mkdirSync(parent, { recursive: true });
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
const conn = new Database(dbPath);
|
|
180
|
-
conn.pragma('journal_mode = WAL');
|
|
181
|
-
conn.pragma('foreign_keys = OFF');
|
|
182
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
183
|
-
const db = drizzle(conn, { schema: {} });
|
|
184
|
-
// Migrate in ascending timestamp order — same pattern as the test suite.
|
|
185
|
-
for (const folder of [
|
|
186
|
-
PROVIDER_MIGRATIONS,
|
|
187
|
-
REGISTRY_MIGRATIONS,
|
|
188
|
-
TOOL_REGISTRY_MIGRATIONS,
|
|
189
|
-
POLICY_MIGRATIONS,
|
|
190
|
-
COMPILER_MIGRATIONS,
|
|
191
|
-
]) {
|
|
192
|
-
if (fs.existsSync(folder)) {
|
|
193
|
-
migrate(db, { migrationsFolder: folder });
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
process.stderr.write(`agent-compiler: warning: migration folder not found: ${folder}\n`);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
conn.pragma('foreign_keys = ON');
|
|
200
|
-
return { conn, db };
|
|
201
|
-
}
|
|
202
|
-
// ──────────────────────────────────────────────
|
|
203
|
-
// Compile a single agent → string artifact
|
|
204
|
-
// ──────────────────────────────────────────────
|
|
205
|
-
function compileSingle(slug, args,
|
|
206
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
207
|
-
db) {
|
|
208
|
-
let result;
|
|
209
|
-
try {
|
|
210
|
-
result = compileAgent({
|
|
211
|
-
agentSlug: slug,
|
|
212
|
-
platform: args.platform,
|
|
213
|
-
context: args.context,
|
|
214
|
-
db,
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
catch (err) {
|
|
218
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
219
|
-
// Distinguish AGENT_NOT_FOUND / PLATFORM_NOT_FOUND from other errors.
|
|
220
|
-
if (msg.includes('not found') || msg.includes('NOT_FOUND')) {
|
|
221
|
-
die(`Error: ${msg}`);
|
|
222
|
-
}
|
|
223
|
-
die(`Compilation failed for '${slug}' on platform '${args.platform}': ${msg}`);
|
|
224
|
-
}
|
|
225
|
-
// --format json overrides the platform's default header format.
|
|
226
|
-
if (args.formatJson) {
|
|
227
|
-
// If content is already JSON (json_object platforms), return as-is.
|
|
228
|
-
try {
|
|
229
|
-
JSON.parse(result.content);
|
|
230
|
-
return result.content; // already valid JSON
|
|
231
|
-
}
|
|
232
|
-
catch {
|
|
233
|
-
// Wrap markdown in a JSON envelope.
|
|
234
|
-
return JSON.stringify({
|
|
235
|
-
systemPrompt: result.content,
|
|
236
|
-
tools: result.tools,
|
|
237
|
-
componentVersions: result.componentVersions,
|
|
238
|
-
}, null, 2);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return result.content;
|
|
242
|
-
}
|
|
243
|
-
// ──────────────────────────────────────────────
|
|
244
|
-
// Output helper
|
|
245
|
-
// ──────────────────────────────────────────────
|
|
246
|
-
/**
|
|
247
|
-
* Write content either to stdout or to <outDir>/<slug>.<ext>.
|
|
248
|
-
*/
|
|
249
|
-
function writeOutput(slug, content, args) {
|
|
250
|
-
if (args.outDir === null) {
|
|
251
|
-
process.stdout.write(content);
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
fs.mkdirSync(args.outDir, { recursive: true });
|
|
255
|
-
const ext = args.formatJson ? 'json' : 'md';
|
|
256
|
-
const dest = path.join(args.outDir, `${slug}.${ext}`);
|
|
257
|
-
fs.writeFileSync(dest, content, 'utf8');
|
|
258
|
-
}
|
|
259
|
-
// ──────────────────────────────────────────────
|
|
260
|
-
// Fatal error helper
|
|
261
|
-
// ──────────────────────────────────────────────
|
|
262
|
-
function die(msg) {
|
|
263
|
-
process.stderr.write(`agent-compiler: ${msg}\n`);
|
|
264
|
-
process.exit(1);
|
|
265
|
-
}
|
|
266
|
-
// ──────────────────────────────────────────────
|
|
267
|
-
// Main
|
|
268
|
-
// ──────────────────────────────────────────────
|
|
269
|
-
function main() {
|
|
270
|
-
const args = parseArgs(process.argv);
|
|
271
|
-
const { conn, db } = openDb(args.dbPath);
|
|
272
|
-
try {
|
|
273
|
-
if (args.all) {
|
|
274
|
-
// Compile every agent in the registry, optionally filtered by category.
|
|
275
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
276
|
-
const agentStore = new AgentStore(db);
|
|
277
|
-
const agents = agentStore.list(args.category ? { category: args.category } : {});
|
|
278
|
-
if (agents.length === 0) {
|
|
279
|
-
const scope = args.category ? ` in category '${args.category}'` : '';
|
|
280
|
-
process.stderr.write(`agent-compiler: no agents found${scope}\n`);
|
|
281
|
-
// Exit 0 — empty category is not an error.
|
|
282
|
-
}
|
|
283
|
-
for (const agent of agents) {
|
|
284
|
-
const content = compileSingle(agent.slug, args, db);
|
|
285
|
-
writeOutput(agent.slug, content, args);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
// Single-slug path.
|
|
290
|
-
// slug is guaranteed non-null here by parseArgs.
|
|
291
|
-
const content = compileSingle(args.slug, args, db);
|
|
292
|
-
writeOutput(args.slug, content, args);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
finally {
|
|
296
|
-
conn.close();
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
main();
|
|
300
|
-
//# sourceMappingURL=compile.js.map
|