@installagent/sdk 0.1.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/dist/agent-templates.d.ts +90 -0
- package/dist/agent-templates.js +211 -0
- package/dist/client-build.d.ts +50 -0
- package/dist/client-build.js +155 -0
- package/dist/client-context.d.ts +40 -0
- package/dist/client-context.js +70 -0
- package/dist/client-drive.d.ts +67 -0
- package/dist/client-drive.js +278 -0
- package/dist/client-intake.d.ts +68 -0
- package/dist/client-intake.js +189 -0
- package/dist/client-linear.d.ts +30 -0
- package/dist/client-linear.js +85 -0
- package/dist/docs-search.d.ts +44 -0
- package/dist/docs-search.js +187 -0
- package/dist/doctor.d.ts +43 -0
- package/dist/doctor.js +425 -0
- package/dist/env-file.d.ts +25 -0
- package/dist/env-file.js +69 -0
- package/dist/env-fill.d.ts +43 -0
- package/dist/env-fill.js +161 -0
- package/dist/env-push.d.ts +37 -0
- package/dist/env-push.js +137 -0
- package/dist/env-registry.d.ts +49 -0
- package/dist/env-registry.js +230 -0
- package/dist/exec.d.ts +14 -0
- package/dist/exec.js +16 -0
- package/dist/fathom-webhook.d.ts +44 -0
- package/dist/fathom-webhook.js +123 -0
- package/dist/fs-utils.d.ts +9 -0
- package/dist/fs-utils.js +34 -0
- package/dist/gcp-service-account-key.d.ts +37 -0
- package/dist/gcp-service-account-key.js +66 -0
- package/dist/gemini-api-key.d.ts +47 -0
- package/dist/gemini-api-key.js +132 -0
- package/dist/git.d.ts +16 -0
- package/dist/git.js +29 -0
- package/dist/github-token.d.ts +24 -0
- package/dist/github-token.js +30 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +28 -0
- package/dist/init.d.ts +47 -0
- package/dist/init.js +101 -0
- package/dist/linear-project.d.ts +81 -0
- package/dist/linear-project.js +192 -0
- package/dist/new-client.d.ts +32 -0
- package/dist/new-client.js +89 -0
- package/dist/ping.d.ts +6 -0
- package/dist/ping.js +7 -0
- package/dist/portal-admin.d.ts +133 -0
- package/dist/portal-admin.js +144 -0
- package/dist/sync-templates.d.ts +58 -0
- package/dist/sync-templates.js +109 -0
- package/dist/template-sync.d.ts +55 -0
- package/dist/template-sync.js +90 -0
- package/dist/templates.d.ts +19 -0
- package/dist/templates.js +24 -0
- package/dist/wizard.d.ts +78 -0
- package/dist/wizard.js +213 -0
- package/package.json +30 -0
- package/templates/env.example +60 -0
- package/templates/workspace-root/.claude/settings.json +39 -0
- package/templates/workspace-root/AGENT.md +205 -0
- package/templates/workspace-root/AGENTS.md +11 -0
- package/templates/workspace-root/CLAUDE.md +63 -0
- package/templates/workspace-root/GEMINI.md +24 -0
- package/templates/workspace-root/ONBOARDING.md +164 -0
- package/templates/workspace-root/README.md +67 -0
- package/templates/workspace-root/skills/CLAUDE.md +79 -0
- package/templates/workspace-root/skills/client-deliverables/SKILL.md +131 -0
- package/templates/workspace-root/skills/client-deliverables/references/package-layout.md +103 -0
- package/templates/workspace-root/skills/client-facing-docs/SKILL.md +131 -0
- package/templates/workspace-root/skills/client-facing-docs/references/doc-structures.md +81 -0
- package/templates/workspace-root/skills/client-llm-setup/SKILL.md +97 -0
- package/templates/workspace-root/skills/client-llm-setup/references/guide-template.md +87 -0
- package/templates/workspace-root/skills/client-workflow-diagram/SKILL.md +141 -0
- package/templates/workspace-root/skills/client-workflow-diagram/references/excalidraw-format.md +140 -0
- package/templates/workspace-root/skills/contract-tech-agnostic/SKILL.md +99 -0
- package/templates/workspace-root/skills/contract-tech-agnostic/references/Install_Agent_SOW_Template.docx +0 -0
- package/templates/workspace-root/skills/design-system/SKILL.md +118 -0
- package/templates/workspace-root/skills/design-system/references/tokens.md +139 -0
- package/templates/workspace-root/skills/engagement-spec/SKILL.md +272 -0
- package/templates/workspace-root/skills/engagement-spec/references/spec-templates.md +220 -0
- package/templates/workspace-root/skills/house-voice/SKILL.md +158 -0
- package/templates/workspace-root/skills/house-voice/references/source-copy.md +173 -0
- package/templates/workspace-root/skills/ia-cli/SKILL.md +87 -0
- package/templates/workspace-root/skills/installagent-brand-kit/SKILL.md +112 -0
- package/templates/workspace-root/skills/installagent-brand-kit/assets/installagent-logo.svg +1 -0
- package/templates/workspace-root/skills/installagent-brand-kit/assets/installagent-mark.svg +1 -0
- package/templates/workspace-root/skills/installagent-brand-kit/references/brand-tokens.md +71 -0
- package/templates/workspace-root/skills/installagent-brand-kit/references/branded-pdf.md +66 -0
- package/templates/workspace-root/skills/installagent-brand-kit/references/excalidraw-red-theme.md +73 -0
- package/templates/workspace-root/skills/installagent-brand-kit/scripts/brand.py +175 -0
- package/templates/workspace-root/skills/linear/SKILL.md +186 -0
- package/templates/workspace-root/skills/tech-call-prep/SKILL.md +141 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const TEAM_DOCS_BASE_URL = "https://team.installagent.com";
|
|
2
|
+
export declare const DOCS_SESSION_ENV = "IA_DOCS_SESSION";
|
|
3
|
+
export interface DocsSearchResult {
|
|
4
|
+
title: string;
|
|
5
|
+
url: string;
|
|
6
|
+
snippet: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DocsSearchResponse {
|
|
9
|
+
query: string;
|
|
10
|
+
/**
|
|
11
|
+
* "api" — served by a Fumadocs /api/search endpoint on the live site.
|
|
12
|
+
* "crawl" — no search endpoint deployed (the case today, verified
|
|
13
|
+
* 2026-07-08); results come from an authenticated crawl of /docs pages.
|
|
14
|
+
*/
|
|
15
|
+
source: "api" | "crawl";
|
|
16
|
+
results: DocsSearchResult[];
|
|
17
|
+
}
|
|
18
|
+
export interface DocsSearchOptions {
|
|
19
|
+
baseUrl?: string;
|
|
20
|
+
limit?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Session for the crawl fallback: either the raw value of the
|
|
23
|
+
* __Secure-authjs.session-token cookie or a full Cookie header string.
|
|
24
|
+
* Defaults to the IA_DOCS_SESSION env var.
|
|
25
|
+
*/
|
|
26
|
+
session?: string;
|
|
27
|
+
/** Injectable for tests; defaults to global fetch. */
|
|
28
|
+
fetchImpl?: typeof fetch;
|
|
29
|
+
}
|
|
30
|
+
/** Thrown when the crawl fallback has no usable Google SSO session. */
|
|
31
|
+
export declare class DocsSessionError extends Error {
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Search the live team docs (team.installagent.com) — never local files, so
|
|
35
|
+
* results can't drift from what's deployed and don't require a team-web
|
|
36
|
+
* checkout.
|
|
37
|
+
*
|
|
38
|
+
* Tries the standard Fumadocs search endpoint (/api/search) first so we
|
|
39
|
+
* automatically upgrade the moment team-web deploys one. Today that route
|
|
40
|
+
* does not exist (the docs app registers only /api/auth/*), so we fall back
|
|
41
|
+
* to crawling the SSO-gated /docs pages with the technician's own session
|
|
42
|
+
* cookie and ranking them client-side.
|
|
43
|
+
*/
|
|
44
|
+
export declare function docsSearch(query: string, options?: DocsSearchOptions): Promise<DocsSearchResponse>;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
export const TEAM_DOCS_BASE_URL = "https://team.installagent.com";
|
|
2
|
+
/** NextAuth v5 production session cookie on team.installagent.com. */
|
|
3
|
+
const SESSION_COOKIE = "__Secure-authjs.session-token";
|
|
4
|
+
export const DOCS_SESSION_ENV = "IA_DOCS_SESSION";
|
|
5
|
+
const CONCURRENCY = 8;
|
|
6
|
+
/** Thrown when the crawl fallback has no usable Google SSO session. */
|
|
7
|
+
export class DocsSessionError extends Error {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Search the live team docs (team.installagent.com) — never local files, so
|
|
11
|
+
* results can't drift from what's deployed and don't require a team-web
|
|
12
|
+
* checkout.
|
|
13
|
+
*
|
|
14
|
+
* Tries the standard Fumadocs search endpoint (/api/search) first so we
|
|
15
|
+
* automatically upgrade the moment team-web deploys one. Today that route
|
|
16
|
+
* does not exist (the docs app registers only /api/auth/*), so we fall back
|
|
17
|
+
* to crawling the SSO-gated /docs pages with the technician's own session
|
|
18
|
+
* cookie and ranking them client-side.
|
|
19
|
+
*/
|
|
20
|
+
export async function docsSearch(query, options = {}) {
|
|
21
|
+
const q = query.trim();
|
|
22
|
+
if (!q) {
|
|
23
|
+
throw new Error("docs search needs a non-empty query");
|
|
24
|
+
}
|
|
25
|
+
const base = (options.baseUrl ?? TEAM_DOCS_BASE_URL).replace(/\/+$/, "");
|
|
26
|
+
const limit = options.limit ?? 8;
|
|
27
|
+
const fetchImpl = options.fetchImpl ?? fetch;
|
|
28
|
+
const apiResults = await tryApiSearch(fetchImpl, base, q);
|
|
29
|
+
if (apiResults) {
|
|
30
|
+
return { query: q, source: "api", results: apiResults.slice(0, limit) };
|
|
31
|
+
}
|
|
32
|
+
const session = options.session ?? process.env[DOCS_SESSION_ENV];
|
|
33
|
+
const results = await crawlSearch(fetchImpl, base, q, limit, session);
|
|
34
|
+
return { query: q, source: "crawl", results };
|
|
35
|
+
}
|
|
36
|
+
function isFumadocsEntry(value) {
|
|
37
|
+
if (typeof value !== "object" || value === null)
|
|
38
|
+
return false;
|
|
39
|
+
const entry = value;
|
|
40
|
+
return (typeof entry.url === "string" &&
|
|
41
|
+
typeof entry.type === "string" &&
|
|
42
|
+
typeof entry.content === "string");
|
|
43
|
+
}
|
|
44
|
+
async function tryApiSearch(fetchImpl, base, query) {
|
|
45
|
+
let data;
|
|
46
|
+
try {
|
|
47
|
+
const res = await fetchImpl(`${base}/api/search?query=${encodeURIComponent(query)}`, {
|
|
48
|
+
redirect: "manual",
|
|
49
|
+
});
|
|
50
|
+
if (!res.ok)
|
|
51
|
+
return undefined;
|
|
52
|
+
data = await res.json();
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
if (!Array.isArray(data))
|
|
58
|
+
return undefined;
|
|
59
|
+
// Fumadocs returns a flat list of {url, type, content} rows: one "page"
|
|
60
|
+
// row per document, then heading/text rows. Group rows into one result
|
|
61
|
+
// per page, preferring a matching text row for the snippet.
|
|
62
|
+
const byUrl = new Map();
|
|
63
|
+
for (const row of data) {
|
|
64
|
+
if (!isFumadocsEntry(row))
|
|
65
|
+
continue;
|
|
66
|
+
const pageUrl = row.url.split("#")[0];
|
|
67
|
+
const absolute = pageUrl.startsWith("http") ? pageUrl : `${base}${pageUrl}`;
|
|
68
|
+
const existing = byUrl.get(pageUrl);
|
|
69
|
+
if (!existing) {
|
|
70
|
+
byUrl.set(pageUrl, {
|
|
71
|
+
title: row.type === "page" ? row.content : pageUrl,
|
|
72
|
+
url: absolute,
|
|
73
|
+
snippet: row.type === "page" ? "" : row.content,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else if (row.type === "page" && (existing.title === pageUrl || !existing.title)) {
|
|
77
|
+
existing.title = row.content;
|
|
78
|
+
}
|
|
79
|
+
else if (!existing.snippet) {
|
|
80
|
+
existing.snippet = row.content;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return [...byUrl.values()];
|
|
84
|
+
}
|
|
85
|
+
async function crawlSearch(fetchImpl, base, query, limit, session) {
|
|
86
|
+
if (!session) {
|
|
87
|
+
throw new DocsSessionError([
|
|
88
|
+
`The team docs (${base}) are gated by Google SSO and expose no public search endpoint, so searching needs your browser session.`,
|
|
89
|
+
`1. Open ${base} in your browser and sign in with your @installagent.com account.`,
|
|
90
|
+
`2. DevTools → Application → Cookies → copy the value of ${SESSION_COOKIE}.`,
|
|
91
|
+
`3. export ${DOCS_SESSION_ENV}="<that value>" (or pass --session).`,
|
|
92
|
+
].join("\n"));
|
|
93
|
+
}
|
|
94
|
+
const cookie = session.includes("=") ? session : `${SESSION_COOKIE}=${session}`;
|
|
95
|
+
const headers = { cookie };
|
|
96
|
+
const rootRes = await fetchImpl(`${base}/docs`, { headers, redirect: "manual" });
|
|
97
|
+
if (rootRes.status >= 300 && rootRes.status < 400) {
|
|
98
|
+
throw new DocsSessionError(`Your docs session was rejected (redirected to login). Grab a fresh ${SESSION_COOKIE} cookie from ${base} and update ${DOCS_SESSION_ENV}.`);
|
|
99
|
+
}
|
|
100
|
+
if (!rootRes.ok) {
|
|
101
|
+
throw new Error(`GET ${base}/docs failed: HTTP ${rootRes.status}`);
|
|
102
|
+
}
|
|
103
|
+
const rootHtml = await rootRes.text();
|
|
104
|
+
const paths = new Set(["/docs"]);
|
|
105
|
+
for (const match of rootHtml.matchAll(/href="(\/docs(?:\/[^"#?]*)?)"/g)) {
|
|
106
|
+
paths.add(match[1]);
|
|
107
|
+
}
|
|
108
|
+
const pages = [];
|
|
109
|
+
const list = [...paths];
|
|
110
|
+
for (let i = 0; i < list.length; i += CONCURRENCY) {
|
|
111
|
+
const chunk = await Promise.all(list.slice(i, i + CONCURRENCY).map(async (path) => {
|
|
112
|
+
try {
|
|
113
|
+
const res = await fetchImpl(`${base}${path}`, { headers, redirect: "manual" });
|
|
114
|
+
if (!res.ok)
|
|
115
|
+
return undefined;
|
|
116
|
+
const { title, text } = extractPage(await res.text());
|
|
117
|
+
return { path, title, text };
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
}));
|
|
123
|
+
for (const page of chunk) {
|
|
124
|
+
if (page)
|
|
125
|
+
pages.push(page);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const terms = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
129
|
+
return pages
|
|
130
|
+
.map((page) => {
|
|
131
|
+
const text = page.text.toLowerCase();
|
|
132
|
+
const title = page.title.toLowerCase();
|
|
133
|
+
let score = 0;
|
|
134
|
+
for (const term of terms) {
|
|
135
|
+
score += countOccurrences(text, term) + countOccurrences(title, term) * 5;
|
|
136
|
+
}
|
|
137
|
+
return { page, score };
|
|
138
|
+
})
|
|
139
|
+
.filter((entry) => entry.score > 0)
|
|
140
|
+
.sort((a, b) => b.score - a.score)
|
|
141
|
+
.slice(0, limit)
|
|
142
|
+
.map(({ page }) => ({
|
|
143
|
+
title: page.title,
|
|
144
|
+
url: `${base}${page.path}`,
|
|
145
|
+
snippet: makeSnippet(page.text, terms),
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
function extractPage(html) {
|
|
149
|
+
// Scope to <article> when present so shared nav/sidebar text doesn't
|
|
150
|
+
// pollute every page's score and snippets.
|
|
151
|
+
const article = html.match(/<article[\s>][\s\S]*?<\/article>/i);
|
|
152
|
+
const title = html.match(/<h1[^>]*>([\s\S]*?)<\/h1>/i)?.[1] ??
|
|
153
|
+
html.match(/<title[^>]*>([\s\S]*?)<\/title>/i)?.[1] ??
|
|
154
|
+
"Untitled";
|
|
155
|
+
return { title: htmlToText(title), text: htmlToText(article ? article[0] : html) };
|
|
156
|
+
}
|
|
157
|
+
function htmlToText(html) {
|
|
158
|
+
return html
|
|
159
|
+
.replace(/<script[\s\S]*?<\/script>/gi, " ")
|
|
160
|
+
.replace(/<style[\s\S]*?<\/style>/gi, " ")
|
|
161
|
+
.replace(/<[^>]+>/g, " ")
|
|
162
|
+
.replace(/</g, "<")
|
|
163
|
+
.replace(/>/g, ">")
|
|
164
|
+
.replace(/"/g, '"')
|
|
165
|
+
.replace(/'|'/g, "'")
|
|
166
|
+
.replace(/ /g, " ")
|
|
167
|
+
.replace(/&/g, "&")
|
|
168
|
+
.replace(/\s+/g, " ")
|
|
169
|
+
.trim();
|
|
170
|
+
}
|
|
171
|
+
function countOccurrences(text, term) {
|
|
172
|
+
return term ? text.split(term).length - 1 : 0;
|
|
173
|
+
}
|
|
174
|
+
function makeSnippet(text, terms) {
|
|
175
|
+
const lower = text.toLowerCase();
|
|
176
|
+
let first = -1;
|
|
177
|
+
for (const term of terms) {
|
|
178
|
+
const idx = lower.indexOf(term);
|
|
179
|
+
if (idx !== -1 && (first === -1 || idx < first))
|
|
180
|
+
first = idx;
|
|
181
|
+
}
|
|
182
|
+
if (first === -1)
|
|
183
|
+
return text.slice(0, 160).trim();
|
|
184
|
+
const start = Math.max(0, first - 60);
|
|
185
|
+
const end = Math.min(text.length, first + 100);
|
|
186
|
+
return `${start > 0 ? "…" : ""}${text.slice(start, end).trim()}${end < text.length ? "…" : ""}`;
|
|
187
|
+
}
|
package/dist/doctor.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ExecFileFn } from "./exec.js";
|
|
2
|
+
export interface DoctorOptions {
|
|
3
|
+
/** installagent/ workspace root to inspect. Defaults to the current dir. */
|
|
4
|
+
workspaceDir?: string;
|
|
5
|
+
/** Environment to check. Defaults to process.env; tests pass a fixture. */
|
|
6
|
+
env?: Record<string, string | undefined>;
|
|
7
|
+
/** Injectable for tests; defaults to real `execFile` (gcloud, gh, op). */
|
|
8
|
+
execFileImpl?: ExecFileFn;
|
|
9
|
+
/** Skip live credential validation — presence checks only, no network. */
|
|
10
|
+
offline?: boolean;
|
|
11
|
+
/** Injectable for tests; defaults to global fetch. */
|
|
12
|
+
fetchImpl?: typeof fetch;
|
|
13
|
+
}
|
|
14
|
+
export type DoctorStatus = "ok" | "missing" | "warn";
|
|
15
|
+
export interface DoctorCheck {
|
|
16
|
+
/** Stable id, `<group>/<name>` — e.g. `env/AIRTABLE_API_TOKEN`. */
|
|
17
|
+
id: string;
|
|
18
|
+
group: "workspace" | "tools" | "env";
|
|
19
|
+
status: DoctorStatus;
|
|
20
|
+
label: string;
|
|
21
|
+
detail: string;
|
|
22
|
+
/** Concrete next step when the check isn't ok. */
|
|
23
|
+
fixIt?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DoctorResult {
|
|
26
|
+
/** True when nothing is `missing` — warnings don't fail the checkup. */
|
|
27
|
+
ok: boolean;
|
|
28
|
+
workspaceDir: string;
|
|
29
|
+
checks: DoctorCheck[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Technician checkup: workspace layout, the gcloud/gh/op CLIs, the env vars
|
|
33
|
+
* the `ia` commands read (derived from the ENV_VARS registry so doctor can
|
|
34
|
+
* never drift from what the operations read), per-clone lefthook hooks, and
|
|
35
|
+
* whether the root .env has a line for every registry var. Set credentials
|
|
36
|
+
* are validated live against their APIs — a revoked token or expired cookie
|
|
37
|
+
* reads `missing`, not green — unless `offline` is set (then presence only).
|
|
38
|
+
* Nothing is ever written and no secret value is ever included in a result;
|
|
39
|
+
* a network hiccup during validation downgrades to a warning, never a
|
|
40
|
+
* failure. `ok` is false only when a core check is `missing`; role-specific
|
|
41
|
+
* gaps surface as warnings.
|
|
42
|
+
*/
|
|
43
|
+
export declare function doctor(options?: DoctorOptions): Promise<DoctorResult>;
|