@ghl-ai/aw 0.1.67 → 0.1.68
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/push.mjs +3 -31
- package/constants.mjs +28 -0
- package/integrate.mjs +2 -0
- package/package.json +1 -1
package/commands/push.mjs
CHANGED
|
@@ -37,9 +37,9 @@ import {
|
|
|
37
37
|
AW_DOCS_SEED_BRANCH,
|
|
38
38
|
AW_DOCS_PUBLISH_DIR,
|
|
39
39
|
AW_DOCS_PUBLIC_BASE_URL,
|
|
40
|
-
AW_DOCS_TEAMOFONE_ORIGIN,
|
|
41
40
|
AW_DOCS_TEAMOFONE_BASE_URL,
|
|
42
41
|
AW_CO_AUTHOR,
|
|
42
|
+
canonicalAwDocsDevtoolsBaseUrl,
|
|
43
43
|
defaultAwDocsConfig,
|
|
44
44
|
} from '../constants.mjs';
|
|
45
45
|
import { resolveInput } from '../paths.mjs';
|
|
@@ -252,7 +252,7 @@ function ensureAwDocsPublishConfig(projectRoot) {
|
|
|
252
252
|
...defaultConfig.sync.github_docs,
|
|
253
253
|
...(config.sync?.github_docs || {}),
|
|
254
254
|
};
|
|
255
|
-
githubDocs.teamofone_base_url =
|
|
255
|
+
githubDocs.teamofone_base_url = canonicalAwDocsDevtoolsBaseUrl(githubDocs.teamofone_base_url);
|
|
256
256
|
|
|
257
257
|
const next = {
|
|
258
258
|
...config,
|
|
@@ -306,7 +306,7 @@ function resolveAwDocsPublishConfig(projectRoot) {
|
|
|
306
306
|
branch,
|
|
307
307
|
seedBranch: process.env.AW_DOCS_SEED_BRANCH || githubDocs.seed_branch || AW_DOCS_SEED_BRANCH,
|
|
308
308
|
dest,
|
|
309
|
-
teamofoneBaseUrl:
|
|
309
|
+
teamofoneBaseUrl: canonicalAwDocsDevtoolsBaseUrl(teamofoneBaseUrl),
|
|
310
310
|
publicBaseUrl,
|
|
311
311
|
};
|
|
312
312
|
}
|
|
@@ -554,34 +554,6 @@ function appendPathToUrl(baseUrl, path) {
|
|
|
554
554
|
return `${basePath.replace(/\/$/, '')}/${encodedPath}${query}${hash}`;
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
function normalizeTeamOfOneBaseUrl(baseUrl) {
|
|
558
|
-
const value = String(baseUrl || '').trim();
|
|
559
|
-
if (!value) return '';
|
|
560
|
-
if (/^https?:\/\//i.test(value)) return value;
|
|
561
|
-
if (value.startsWith('/')) return `${AW_DOCS_TEAMOFONE_ORIGIN.replace(/\/$/, '')}${value}`;
|
|
562
|
-
return `https://${value.replace(/^\/+/, '')}`;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
function canonicalDevtoolsBaseUrl(baseUrl) {
|
|
566
|
-
const canonical = AW_DOCS_TEAMOFONE_BASE_URL.replace(/\/+$/, '');
|
|
567
|
-
const normalized = normalizeTeamOfOneBaseUrl(baseUrl).replace(/\/+$/, '');
|
|
568
|
-
if (!normalized) return canonical;
|
|
569
|
-
|
|
570
|
-
try {
|
|
571
|
-
const expected = new URL(canonical);
|
|
572
|
-
const actual = new URL(normalized);
|
|
573
|
-
const expectedPath = expected.pathname.replace(/\/+$/, '');
|
|
574
|
-
const actualPath = actual.pathname.replace(/\/+$/, '');
|
|
575
|
-
if (actual.origin === expected.origin && actualPath === expectedPath) {
|
|
576
|
-
return canonical;
|
|
577
|
-
}
|
|
578
|
-
} catch {
|
|
579
|
-
return canonical;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
return canonical;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
557
|
function appendQueryParam(url, key, value) {
|
|
586
558
|
const hashIndex = url.indexOf('#');
|
|
587
559
|
const withoutHash = hashIndex === -1 ? url : url.slice(0, hashIndex);
|
package/constants.mjs
CHANGED
|
@@ -40,6 +40,34 @@ export const AW_DOCS_TEAMOFONE_ORIGIN = AW_DOCS_DEVTOOLS_ORIGIN;
|
|
|
40
40
|
/** @deprecated Use AW_DOCS_DEVTOOLS_BASE_URL. Kept as an alias for older config keys. */
|
|
41
41
|
export const AW_DOCS_TEAMOFONE_BASE_URL = AW_DOCS_DEVTOOLS_BASE_URL;
|
|
42
42
|
|
|
43
|
+
function normalizeAwDocsShareBaseUrl(baseUrl) {
|
|
44
|
+
const value = String(baseUrl || '').trim();
|
|
45
|
+
if (!value) return '';
|
|
46
|
+
if (/^https?:\/\//i.test(value)) return value;
|
|
47
|
+
if (value.startsWith('/')) return `${AW_DOCS_DEVTOOLS_ORIGIN.replace(/\/$/, '')}${value}`;
|
|
48
|
+
return `https://${value.replace(/^\/+/, '')}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function canonicalAwDocsDevtoolsBaseUrl(baseUrl) {
|
|
52
|
+
const canonical = AW_DOCS_DEVTOOLS_BASE_URL.replace(/\/+$/, '');
|
|
53
|
+
const normalized = normalizeAwDocsShareBaseUrl(baseUrl).replace(/\/+$/, '');
|
|
54
|
+
if (!normalized) return canonical;
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
const expected = new URL(canonical);
|
|
58
|
+
const actual = new URL(normalized);
|
|
59
|
+
const expectedPath = expected.pathname.replace(/\/+$/, '');
|
|
60
|
+
const actualPath = actual.pathname.replace(/\/+$/, '');
|
|
61
|
+
if (actual.origin === expected.origin && actualPath === expectedPath) {
|
|
62
|
+
return canonical;
|
|
63
|
+
}
|
|
64
|
+
} catch {
|
|
65
|
+
return canonical;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return canonical;
|
|
69
|
+
}
|
|
70
|
+
|
|
43
71
|
export function defaultAwDocsGithubDocsConfig() {
|
|
44
72
|
return {
|
|
45
73
|
enabled: true,
|
package/integrate.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { isDefaultRoutingEnabled } from './startup.mjs';
|
|
16
16
|
import {
|
|
17
17
|
AW_DOCS_DIR,
|
|
18
|
+
canonicalAwDocsDevtoolsBaseUrl,
|
|
18
19
|
defaultAwDocsConfig,
|
|
19
20
|
} from './constants.mjs';
|
|
20
21
|
|
|
@@ -665,6 +666,7 @@ No active runs. Use \`/aw:<team>-<command>\` to start a workflow.
|
|
|
665
666
|
github_docs: {
|
|
666
667
|
...defaultConfig.sync.github_docs,
|
|
667
668
|
...(existing.sync?.github_docs || {}),
|
|
669
|
+
teamofone_base_url: canonicalAwDocsDevtoolsBaseUrl(existing.sync?.github_docs?.teamofone_base_url),
|
|
668
670
|
},
|
|
669
671
|
},
|
|
670
672
|
paths: {
|