@ghl-ai/aw 0.1.26-beta.2 → 0.1.26-beta.3
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/commands/pull.mjs +30 -18
- package/constants.mjs +3 -0
- package/git.mjs +7 -1
- package/package.json +1 -1
package/commands/pull.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// commands/pull.mjs — Pull content from registry
|
|
2
2
|
|
|
3
|
-
import { mkdirSync, existsSync, readdirSync, copyFileSync
|
|
3
|
+
import { mkdirSync, existsSync, readdirSync, copyFileSync } from 'node:fs';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
5
|
import { homedir } from 'node:os';
|
|
6
6
|
import { execSync } from 'node:child_process';
|
|
@@ -8,7 +8,7 @@ import * as config from '../config.mjs';
|
|
|
8
8
|
import * as fmt from '../fmt.mjs';
|
|
9
9
|
import { chalk } from '../fmt.mjs';
|
|
10
10
|
import { sparseCheckout, sparseCheckoutAsync, cleanup, includeToSparsePaths } from '../git.mjs';
|
|
11
|
-
import { REGISTRY_DIR } from '../constants.mjs';
|
|
11
|
+
import { REGISTRY_DIR, DOCS_SOURCE_DIR } from '../constants.mjs';
|
|
12
12
|
import { walkRegistryTree } from '../registry.mjs';
|
|
13
13
|
import { matchesAny } from '../glob.mjs';
|
|
14
14
|
import { computePlan } from '../plan.mjs';
|
|
@@ -191,14 +191,11 @@ export async function pullCommand(args) {
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
//
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
mkdirSync(dest, { recursive: true });
|
|
200
|
-
cpSync(docsDir, dest, { recursive: true });
|
|
201
|
-
}
|
|
194
|
+
// Sync docs from repo content/ into platform/docs/ (markdown only, skip images)
|
|
195
|
+
const contentSrc = join(tempDir, DOCS_SOURCE_DIR);
|
|
196
|
+
if (existsSync(contentSrc)) {
|
|
197
|
+
const docsDest = join(workspaceDir, 'platform', 'docs');
|
|
198
|
+
copyMarkdownTree(contentSrc, docsDest);
|
|
202
199
|
}
|
|
203
200
|
|
|
204
201
|
// MCP registration (second-class — skip if not available)
|
|
@@ -293,14 +290,11 @@ export async function pullAsync(args) {
|
|
|
293
290
|
if (existsSync(src)) copyFileSync(src, join(workspaceDir, fname));
|
|
294
291
|
}
|
|
295
292
|
|
|
296
|
-
//
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
mkdirSync(dest, { recursive: true });
|
|
302
|
-
cpSync(docsDir, dest, { recursive: true });
|
|
303
|
-
}
|
|
293
|
+
// Sync docs from repo content/ into platform/docs/ (markdown only, skip images)
|
|
294
|
+
const contentSrc = join(tempDir, DOCS_SOURCE_DIR);
|
|
295
|
+
if (existsSync(contentSrc)) {
|
|
296
|
+
const docsDest = join(workspaceDir, 'platform', 'docs');
|
|
297
|
+
copyMarkdownTree(contentSrc, docsDest);
|
|
304
298
|
}
|
|
305
299
|
|
|
306
300
|
return { pattern, actions, conflictCount };
|
|
@@ -315,6 +309,24 @@ function listDirs(dir) {
|
|
|
315
309
|
.map(d => d.name);
|
|
316
310
|
}
|
|
317
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Recursively copy only .md files from src to dest, preserving directory structure.
|
|
314
|
+
* Skips images and other non-markdown content.
|
|
315
|
+
*/
|
|
316
|
+
function copyMarkdownTree(src, dest) {
|
|
317
|
+
mkdirSync(dest, { recursive: true });
|
|
318
|
+
for (const entry of readdirSync(src, { withFileTypes: true })) {
|
|
319
|
+
if (entry.name.startsWith('.')) continue;
|
|
320
|
+
const srcPath = join(src, entry.name);
|
|
321
|
+
const destPath = join(dest, entry.name);
|
|
322
|
+
if (entry.isDirectory()) {
|
|
323
|
+
copyMarkdownTree(srcPath, destPath);
|
|
324
|
+
} else if (entry.name.endsWith('.md')) {
|
|
325
|
+
copyFileSync(srcPath, destPath);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
318
330
|
function registerMcp(namespace) {
|
|
319
331
|
const mcpUrl = process.env.GHL_MCP_URL;
|
|
320
332
|
if (!mcpUrl) return;
|
package/constants.mjs
CHANGED
|
@@ -8,3 +8,6 @@ export const REGISTRY_REPO = 'GoHighLevel/platform-docs';
|
|
|
8
8
|
|
|
9
9
|
/** Directory inside the registry repo that holds platform/ and [template]/ */
|
|
10
10
|
export const REGISTRY_DIR = '.aw_registry';
|
|
11
|
+
|
|
12
|
+
/** Directory in platform-docs repo containing documentation (pulled into platform/docs/) */
|
|
13
|
+
export const DOCS_SOURCE_DIR = 'content';
|
package/git.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { mkdtempSync, existsSync } from 'node:fs';
|
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { tmpdir } from 'node:os';
|
|
7
7
|
import { promisify } from 'node:util';
|
|
8
|
-
import { REGISTRY_BASE_BRANCH, REGISTRY_DIR } from './constants.mjs';
|
|
8
|
+
import { REGISTRY_BASE_BRANCH, REGISTRY_DIR, DOCS_SOURCE_DIR } from './constants.mjs';
|
|
9
9
|
|
|
10
10
|
const exec = promisify(execCb);
|
|
11
11
|
|
|
@@ -77,6 +77,9 @@ export function cleanup(tempDir) {
|
|
|
77
77
|
/**
|
|
78
78
|
* Compute sparse checkout paths from include paths.
|
|
79
79
|
* e.g., ["platform", "dev/agents/debugger"] -> [".aw_registry/platform", ".aw_registry/dev/agents/debugger"]
|
|
80
|
+
*
|
|
81
|
+
* When "platform" is in the paths, also includes the repo's docs source
|
|
82
|
+
* directory (content/) so docs are pulled on-the-fly into platform/docs/.
|
|
80
83
|
*/
|
|
81
84
|
export function includeToSparsePaths(paths) {
|
|
82
85
|
const result = new Set();
|
|
@@ -84,5 +87,8 @@ export function includeToSparsePaths(paths) {
|
|
|
84
87
|
result.add(`${REGISTRY_DIR}/${p}`);
|
|
85
88
|
}
|
|
86
89
|
result.add(`${REGISTRY_DIR}/AW-PROTOCOL.md`);
|
|
90
|
+
if (paths.includes('platform')) {
|
|
91
|
+
result.add(DOCS_SOURCE_DIR);
|
|
92
|
+
}
|
|
87
93
|
return [...result];
|
|
88
94
|
}
|