@ghl-ai/aw 0.1.47 → 0.1.48-beta.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/commands/push.mjs CHANGED
@@ -36,6 +36,7 @@ import {
36
36
  AW_DOCS_SEED_BRANCH,
37
37
  AW_DOCS_PUBLISH_DIR,
38
38
  AW_DOCS_PUBLIC_BASE_URL,
39
+ AW_DOCS_TEAMOFONE_BASE_URL,
39
40
  AW_CO_AUTHOR,
40
41
  defaultAwDocsGithubDocsConfig,
41
42
  } from '../constants.mjs';
@@ -216,8 +217,14 @@ function resolveAwDocsPublishConfig(projectRoot) {
216
217
  const branch = AW_DOCS_BASE_BRANCH;
217
218
  const repoUrl = process.env.AW_DOCS_REPO_URL || githubDocs.repo_url || repoCloneUrl(repo);
218
219
  const dest = safePathSegment(process.env.AW_DOCS_PUBLISH_DIR || githubDocs.dest || AW_DOCS_PUBLISH_DIR, AW_DOCS_PUBLISH_DIR);
220
+ const teamofoneBaseUrl = String(
221
+ process.env.AW_DOCS_TEAMOFONE_BASE_URL
222
+ || githubDocs.teamofone_base_url
223
+ || AW_DOCS_TEAMOFONE_BASE_URL
224
+ || '',
225
+ ).trim();
219
226
  const publicBaseUrl = process.env.AW_DOCS_PUBLIC_BASE_URL
220
- || githubDocs.teamofone_base_url
227
+ || githubDocs.public_base_url
221
228
  || `https://github.com/${String(repo).replace(/\.git$/, '')}/blob/${branch}`;
222
229
 
223
230
  return {
@@ -227,6 +234,7 @@ function resolveAwDocsPublishConfig(projectRoot) {
227
234
  branch,
228
235
  seedBranch: process.env.AW_DOCS_SEED_BRANCH || githubDocs.seed_branch || AW_DOCS_SEED_BRANCH,
229
236
  dest,
237
+ teamofoneBaseUrl,
230
238
  publicBaseUrl,
231
239
  };
232
240
  }
@@ -370,14 +378,47 @@ async function remoteBranchExists(repoDir, branchName) {
370
378
  }
371
379
  }
372
380
 
381
+ function appendPathToUrl(baseUrl, path) {
382
+ const encodedPath = path.split('/').map(encodeURIComponent).join('/');
383
+ const hashIndex = baseUrl.indexOf('#');
384
+ const withoutHash = hashIndex === -1 ? baseUrl : baseUrl.slice(0, hashIndex);
385
+ const hash = hashIndex === -1 ? '' : baseUrl.slice(hashIndex);
386
+ const queryIndex = withoutHash.indexOf('?');
387
+ const basePath = queryIndex === -1 ? withoutHash : withoutHash.slice(0, queryIndex);
388
+ const query = queryIndex === -1 ? '' : withoutHash.slice(queryIndex);
389
+ return `${basePath.replace(/\/$/, '')}/${encodedPath}${query}${hash}`;
390
+ }
391
+
392
+ function appendQueryParam(url, key, value) {
393
+ const hashIndex = url.indexOf('#');
394
+ const withoutHash = hashIndex === -1 ? url : url.slice(0, hashIndex);
395
+ const hash = hashIndex === -1 ? '' : url.slice(hashIndex);
396
+ const separator = withoutHash.includes('?') ? '&' : '?';
397
+ return `${withoutHash}${separator}${encodeURIComponent(key)}=${encodeURIComponent(value)}${hash}`;
398
+ }
399
+
400
+ function awDocsTeamOfOneUrl(publishedPath, publishConfig) {
401
+ if (!publishConfig.teamofoneBaseUrl) return null;
402
+ return appendQueryParam(
403
+ appendPathToUrl(publishConfig.teamofoneBaseUrl, publishedPath),
404
+ 'ref',
405
+ publishConfig.branch,
406
+ );
407
+ }
408
+
409
+ function awDocsPublicUrl(publishedPath, publishConfig) {
410
+ return appendPathToUrl(publishConfig.publicBaseUrl, publishedPath);
411
+ }
412
+
373
413
  function awDocsRemoteUrl(publishedPath, publishConfig) {
374
- return `${publishConfig.publicBaseUrl.replace(/\/$/, '')}/${publishedPath.split('/').map(encodeURIComponent).join('/')}`;
414
+ return awDocsTeamOfOneUrl(publishedPath, publishConfig)
415
+ || awDocsPublicUrl(publishedPath, publishConfig);
375
416
  }
376
417
 
377
418
  function awDocsRepositoryUrl(publishedPath, publishConfig) {
378
419
  const repo = String(publishConfig.repo || AW_DOCS_REPO).replace(/\.git$/, '');
379
- if (!repo.includes('/')) return awDocsRemoteUrl(publishedPath, publishConfig);
380
- return `https://github.com/${repo}/blob/${publishConfig.branch}/${publishedPath.split('/').map(encodeURIComponent).join('/')}`;
420
+ if (!repo.includes('/')) return awDocsPublicUrl(publishedPath, publishConfig);
421
+ return appendPathToUrl(`https://github.com/${repo}/blob/${publishConfig.branch}`, publishedPath);
381
422
  }
382
423
 
383
424
  function printAwDocsLinks(links, limit = 10) {
package/constants.mjs CHANGED
@@ -33,12 +33,14 @@ export const AW_DOCS_BASE_BRANCH = 'master-sync';
33
33
  export const AW_DOCS_SEED_BRANCH = process.env.AW_DOCS_SEED_BRANCH || 'scaffold';
34
34
  export const AW_DOCS_PUBLISH_DIR = 'aw_docs';
35
35
  export const AW_DOCS_PUBLIC_BASE_URL = process.env.AW_DOCS_PUBLIC_BASE_URL || `https://github.com/${AW_DOCS_REPO}/blob/${AW_DOCS_BASE_BRANCH}`;
36
+ export const AW_DOCS_TEAMOFONE_BASE_URL = process.env.AW_DOCS_TEAMOFONE_BASE_URL || `https://teamofone.msgsndr.net/too/docs/${AW_DOCS_REPO}`;
36
37
 
37
38
  export function defaultAwDocsGithubDocsConfig() {
38
39
  return {
39
40
  enabled: true,
40
41
  repo: AW_DOCS_REPO,
41
42
  dest: AW_DOCS_PUBLISH_DIR,
43
+ teamofone_base_url: AW_DOCS_TEAMOFONE_BASE_URL,
42
44
  };
43
45
  }
44
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.47",
3
+ "version": "0.1.48-beta.0",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": {