agentsclimarketplace

Glean hello world

Skill jeremylongshore/claude-code-plugins-plus-skills/plugins/saas-packs/glean-pack/skills/glean-hello-world

'Index documents into Glean and search them back using the Indexing and Client APIs.From its SKILL.md

Install
npx -y skills add jeremylongshore/claude-code-plugins-plus-skills --skill glean-hello-world

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

3.3 KB, 702 tokens by cl100k_base, as published. Nobody here has run it

Glean Hello World

Overview

Index documents into Glean and search them. Two steps: set up a custom datasource with the Indexing API, then query with the Client API.

Instructions

Step 1: Set Up Custom Datasource

const GLEAN = `https://${process.env.GLEAN_DOMAIN}/api`;
const idxHeaders = {
  'Authorization': `Bearer ${process.env.GLEAN_INDEXING_TOKEN}`,
  'Content-Type': 'application/json',
};

// Create or configure a custom datasource
await fetch(`${GLEAN}/index/v1/adddatasource`, {
  method: 'POST', headers: idxHeaders,
  body: JSON.stringify({
    name: 'my_wiki',
    displayName: 'Internal Wiki',
    datasourceCategory: 'PUBLISHED_CONTENT',
    urlRegex: 'https://wiki.company.com/.*',
    iconUrl: 'https://wiki.company.com/favicon.ico',
  }),
});

Step 2: Index Documents

// Index individual documents
await fetch(`${GLEAN}/index/v1/indexdocuments`, {
  method: 'POST', headers: idxHeaders,
  body: JSON.stringify({
    datasource: 'my_wiki',
    documents: [{
      id: 'doc-001',
      title: 'Getting Started Guide',
      url: 'https://wiki.company.com/getting-started',
      body: { mimeType: 'text/plain', textContent: 'This guide covers onboarding steps...' },
      author: { email: '[email protected]' },
      updatedAt: new Date().toISOString(),
      permissions: { allowAnonymousAccess: true },
    }],
  }),
});
console.log('Document indexed.');

Step 3: Search

const searchHeaders = {
  'Authorization': `Bearer ${process.env.GLEAN_CLIENT_TOKEN}`,
  'X-Glean-Auth-Type': 'BEARER',
  'Content-Type': 'application/json',
};

const results = await fetch(`${GLEAN}/client/v1/search`, {
  method: 'POST', headers: searchHeaders,
  body: JSON.stringify({
    query: 'onboarding getting started',
    pageSize: 10,
    requestOptions: { datasourceFilter: 'my_wiki' },
  }),
}).then(r => r.json());

results.results?.forEach((r: any) => {
  console.log(`${r.title} (${r.url}) — score: ${r.score}`);
});

Output

Document indexed.
Getting Started Guide (https://wiki.company.com/getting-started) — score: 0.95

Error Handling

ErrorCauseSolution
datasource not foundDatasource not createdRun adddatasource first
No search resultsIndexing not yet completeWait 1-2 minutes for processing
invalid documentMissing required fieldsInclude id, title, url

Resources

Next Steps

Proceed to glean-local-dev-loop for development workflow setup.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,144. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.