lean-agents 0.0.0-stage → 1.0.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.
Files changed (148) hide show
  1. package/CHANGELOG.md +407 -0
  2. package/LICENSE +21 -0
  3. package/README.es.md +560 -0
  4. package/README.md +559 -2
  5. package/core/AGENTS.es.md +60 -0
  6. package/core/AGENTS.md +60 -0
  7. package/core/README.md +8 -0
  8. package/core/agents/debug.md +14 -0
  9. package/core/agents/explore.md +13 -0
  10. package/core/agents/planner.md +14 -0
  11. package/core/agents/research.md +13 -0
  12. package/core/agents/review.md +13 -0
  13. package/core/copilot-usage-tui.js +189 -0
  14. package/core/mcp.json +38 -0
  15. package/core/pins.json +39 -0
  16. package/core/tiers.json +4 -0
  17. package/node_modules/@clack/core/LICENSE +9 -0
  18. package/node_modules/@clack/core/README.md +22 -0
  19. package/node_modules/@clack/core/dist/index.d.mts +503 -0
  20. package/node_modules/@clack/core/dist/index.mjs +1003 -0
  21. package/node_modules/@clack/core/package.json +63 -0
  22. package/node_modules/@clack/prompts/LICENSE +9 -0
  23. package/node_modules/@clack/prompts/README.md +396 -0
  24. package/node_modules/@clack/prompts/dist/index.d.mts +949 -0
  25. package/node_modules/@clack/prompts/dist/index.mjs +1423 -0
  26. package/node_modules/@clack/prompts/package.json +67 -0
  27. package/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
  28. package/node_modules/fast-string-truncated-width/dist/index.js +111 -0
  29. package/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
  30. package/node_modules/fast-string-truncated-width/dist/types.js +2 -0
  31. package/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
  32. package/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
  33. package/node_modules/fast-string-truncated-width/license +21 -0
  34. package/node_modules/fast-string-truncated-width/package.json +35 -0
  35. package/node_modules/fast-string-truncated-width/readme.md +59 -0
  36. package/node_modules/fast-string-width/dist/index.d.ts +4 -0
  37. package/node_modules/fast-string-width/dist/index.js +14 -0
  38. package/node_modules/fast-string-width/license +21 -0
  39. package/node_modules/fast-string-width/package.json +34 -0
  40. package/node_modules/fast-string-width/readme.md +42 -0
  41. package/node_modules/fast-wrap-ansi/LICENSE +23 -0
  42. package/node_modules/fast-wrap-ansi/README.md +26 -0
  43. package/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
  44. package/node_modules/fast-wrap-ansi/lib/main.js +218 -0
  45. package/node_modules/fast-wrap-ansi/package.json +51 -0
  46. package/node_modules/jsonc-parser/CHANGELOG.md +76 -0
  47. package/node_modules/jsonc-parser/LICENSE.md +21 -0
  48. package/node_modules/jsonc-parser/README.md +364 -0
  49. package/node_modules/jsonc-parser/SECURITY.md +41 -0
  50. package/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
  51. package/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
  52. package/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
  53. package/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
  54. package/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
  55. package/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
  56. package/node_modules/jsonc-parser/lib/esm/main.js +178 -0
  57. package/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
  58. package/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
  59. package/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
  60. package/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
  61. package/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
  62. package/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
  63. package/node_modules/jsonc-parser/lib/umd/main.js +194 -0
  64. package/node_modules/jsonc-parser/package.json +37 -0
  65. package/node_modules/sisteransi/license +21 -0
  66. package/node_modules/sisteransi/package.json +34 -0
  67. package/node_modules/sisteransi/readme.md +113 -0
  68. package/node_modules/sisteransi/src/index.js +58 -0
  69. package/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
  70. package/package.json +30 -4
  71. package/profiles/README.md +10 -0
  72. package/profiles/anthropic-api/gsd-defaults.json +26 -0
  73. package/profiles/anthropic-api.json +18 -0
  74. package/profiles/antigravity.json +12 -0
  75. package/profiles/claude-subscription/gsd-defaults.json +26 -0
  76. package/profiles/claude-subscription.json +17 -0
  77. package/profiles/github-copilot/gsd-defaults.json +26 -0
  78. package/profiles/github-copilot.json +17 -0
  79. package/profiles/openai-api/gsd-defaults.json +26 -0
  80. package/profiles/openai-api.json +17 -0
  81. package/profiles/opencode-go/gsd-defaults.json +26 -0
  82. package/profiles/opencode-go.json +17 -0
  83. package/profiles/vertex-gemini/gsd-defaults.json +26 -0
  84. package/profiles/vertex-gemini.json +18 -0
  85. package/scripts/adhd-skill.mjs +12 -0
  86. package/scripts/behavior-diff.sh +47 -0
  87. package/scripts/bump-pins.mjs +115 -0
  88. package/scripts/check-private.sh +52 -0
  89. package/scripts/check-readme.mjs +131 -0
  90. package/scripts/ci-download.sh +20 -0
  91. package/scripts/ci-install-opencode-v2.sh +6 -0
  92. package/scripts/ci-latest-report.mjs +38 -0
  93. package/scripts/ci-timing.mjs +61 -0
  94. package/scripts/copilot-context-mode.mjs +33 -0
  95. package/scripts/labels.sh +56 -0
  96. package/scripts/lean.mjs +1319 -0
  97. package/scripts/lib/adapters/antigravity.mjs +83 -0
  98. package/scripts/lib/adapters/claude.mjs +127 -0
  99. package/scripts/lib/adapters/copilot-cli.mjs +82 -0
  100. package/scripts/lib/adapters/cursor.mjs +60 -0
  101. package/scripts/lib/adapters/opencode-v1.mjs +79 -0
  102. package/scripts/lib/adapters/opencode-v2.mjs +216 -0
  103. package/scripts/lib/adapters/vscode-copilot.mjs +56 -0
  104. package/scripts/lib/adhd.mjs +28 -0
  105. package/scripts/lib/adopt.mjs +619 -0
  106. package/scripts/lib/agent-lifecycle.mjs +280 -0
  107. package/scripts/lib/backup-stamp.mjs +25 -0
  108. package/scripts/lib/copilot-usage.mjs +49 -0
  109. package/scripts/lib/doctor.mjs +279 -0
  110. package/scripts/lib/feedback.mjs +48 -0
  111. package/scripts/lib/fsops.mjs +319 -0
  112. package/scripts/lib/gsd.mjs +42 -0
  113. package/scripts/lib/inventory.mjs +196 -0
  114. package/scripts/lib/lean-update.mjs +30 -0
  115. package/scripts/lib/logins.mjs +28 -0
  116. package/scripts/lib/migrate.mjs +407 -0
  117. package/scripts/lib/network.mjs +119 -0
  118. package/scripts/lib/node-runtime.mjs +85 -0
  119. package/scripts/lib/opencode-backup.mjs +204 -0
  120. package/scripts/lib/opencode-upgrade.mjs +441 -0
  121. package/scripts/lib/opencode1.mjs +203 -0
  122. package/scripts/lib/parallel.mjs +270 -0
  123. package/scripts/lib/pins-diff.mjs +33 -0
  124. package/scripts/lib/pins.mjs +52 -0
  125. package/scripts/lib/plugin-health.mjs +191 -0
  126. package/scripts/lib/prereqs.mjs +203 -0
  127. package/scripts/lib/project.mjs +38 -0
  128. package/scripts/lib/redact.mjs +30 -0
  129. package/scripts/lib/render.mjs +101 -0
  130. package/scripts/lib/shell-path.mjs +22 -0
  131. package/scripts/lib/summary-data.mjs +30 -0
  132. package/scripts/lib/summary-html.mjs +159 -0
  133. package/scripts/lib/system.mjs +269 -0
  134. package/scripts/lib/terminals.mjs +316 -0
  135. package/scripts/lib/ui.mjs +34 -0
  136. package/scripts/lib/unverified.mjs +49 -0
  137. package/scripts/lib/update-plan.mjs +60 -0
  138. package/scripts/lib/upgrade.mjs +231 -0
  139. package/scripts/lib/verify-commit.mjs +16 -0
  140. package/scripts/lib/verify-prompt.mjs +46 -0
  141. package/scripts/lib/verify-sha256.mjs +20 -0
  142. package/scripts/lint-workflows.mjs +25 -0
  143. package/scripts/models-refresh.mjs +58 -0
  144. package/scripts/parallel.mjs +59 -0
  145. package/scripts/pins-latest.mjs +66 -0
  146. package/scripts/release.mjs +71 -0
  147. package/scripts/verify-pins.mjs +36 -0
  148. package/scripts/version-watch.mjs +124 -0
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env node
2
+ // Daily check of core/pins.json against npm and GitHub tags. Opens one `version-watch` issue per item with a newer
3
+ // version, or comments on the open one. Read-only for the repo: it never changes a pin.
4
+ import fs from 'node:fs';
5
+ import { fileURLToPath, pathToFileURL } from 'node:url';
6
+
7
+ const ROOT = fileURLToPath(new URL('..', import.meta.url));
8
+ const LABEL = 'version-watch';
9
+ const STABLE = /^v?\d+\.\d+\.\d+$/;
10
+ const mark = (v) => `<!-- version-watch:${v} -->`;
11
+ const parts = (v) => v.replace(/^v/, '').split('.').map(Number);
12
+
13
+ // True when `next` is a higher stable x.y.z than `current`.
14
+ export function isNewer(current, next) {
15
+ if (!STABLE.test(next)) return false;
16
+ const [a, b] = [parts(current), parts(next)];
17
+ for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return b[i] > a[i];
18
+ return false;
19
+ }
20
+
21
+ export function notesUrl(p, version) {
22
+ if (p.kind === 'npm') return `https://www.npmjs.com/package/${p.source}/v/${version}`;
23
+ if (p.kind === 'cask') return `https://formulae.brew.sh/cask/${p.source}`;
24
+ return `https://github.com/${p.source}/releases/tag/${p.tagPrefix ?? ''}${version}`;
25
+ }
26
+
27
+ function render(key, p, version) {
28
+ return [
29
+ `Confirmed to work: \`${p.version}\` (verified ${p.verified}).`,
30
+ `New upstream version: \`${version}\`.`,
31
+ `Release notes: ${notesUrl(p, version)}`,
32
+ 'Do not bump to a version published in the last 14 days.',
33
+ ...(p.note ? [`Note: ${p.note}`] : []),
34
+ `Run before bumping: the \`${p.ci}\` job (or its \`tests/real-*.sh\` script in a sandbox HOME).`,
35
+ 'This watch never changes pins. To bump, follow "Tool versions" in `skills/update-models/SKILL.md` and edit `core/pins.json` after the owner approves.',
36
+ mark(version),
37
+ ].join('\n\n');
38
+ }
39
+
40
+ // pins: core/pins.json "pins"; latest: { key: version|null }; issues: every version-watch issue, open or closed:
41
+ // [{ number, title, state, body, comments: [string] }]. A closed issue still counts as "already reported".
42
+ export function plan(pins, latest, issues) {
43
+ const actions = [];
44
+ for (const [key, p] of Object.entries(pins)) {
45
+ const version = latest[key];
46
+ if (!version || !isNewer(p.version, version)) continue;
47
+ const title = `Update available: ${key}`;
48
+ const same = issues.filter((i) => i.title === title);
49
+ if (same.some((i) => [i.body, ...i.comments].some((t) => t?.includes(mark(version))))) continue;
50
+ const issue = same.find((i) => i.state === 'open');
51
+ const body = render(key, p, version);
52
+ if (!issue) actions.push({ type: 'create', key, title, body });
53
+ else actions.push({ type: 'comment', key, number: issue.number, body });
54
+ }
55
+ return actions;
56
+ }
57
+
58
+ export async function latestVersion(p, get) {
59
+ if (p.kind === 'npm') return (await get(`https://registry.npmjs.org/${p.source.replace('/', '%2F')}/latest`)).version;
60
+ // Homebrew cask (Antigravity): its version is "1.5.11,<build>"; only the part before the comma is the release.
61
+ if (p.kind === 'cask') return (await get(`https://formulae.brew.sh/api/cask/${p.source}.json`)).version.split(',')[0];
62
+ // shortcut: first 100 tags only, enough for repos that tag per release; page if a repo outgrows that.
63
+ // tagPrefix: Bun tags `bun-v1.4.4`; the prefix is dropped so versions compare as x.y.z.
64
+ const pre = p.tagPrefix ?? '';
65
+ const tags = (await get(`https://api.github.com/repos/${p.source}/tags?per_page=100`)).map((t) => t.name).filter((n) => n.startsWith(pre)).map((n) => n.slice(pre.length)).filter((n) => STABLE.test(n));
66
+ return tags.reduce((best, n) => (!best || isNewer(best, n) ? n : best), null);
67
+ }
68
+
69
+ // Commit SHA a GitHub tag points at (annotated tags are dereferenced).
70
+ export async function tagSha(source, tag, get) {
71
+ const ref = (await get(`https://api.github.com/repos/${source}/git/ref/tags/${tag}`)).object;
72
+ return ref.type === 'tag' ? (await get(`https://api.github.com/repos/${source}/git/tags/${ref.sha}`)).object.sha : ref.sha;
73
+ }
74
+
75
+ // api: { list(), comments(number), create(title, body), comment(number, body) }
76
+ export async function run({ pins, get, api, log = console.log }) {
77
+ const latest = {};
78
+ for (const [key, p] of Object.entries(pins)) {
79
+ try { latest[key] = await latestVersion(p, get); } catch (e) { log(`! ${key}: ${e.message}`); }
80
+ }
81
+ const issues = await api.list();
82
+ for (const i of issues) i.comments = await api.comments(i.number);
83
+ const actions = plan(pins, latest, issues);
84
+ for (const a of actions) {
85
+ if (a.type === 'create') await api.create(a.title, a.body);
86
+ else await api.comment(a.number, a.body);
87
+ log(`${a.type}: ${a.key}`);
88
+ }
89
+ if (!actions.length) log('nothing new');
90
+ return actions;
91
+ }
92
+
93
+ export function githubApi(repo, token) {
94
+ const call = async (method, url, body) => {
95
+ const r = await fetch(`https://api.github.com/repos/${repo}${url}`, {
96
+ method,
97
+ headers: { authorization: `Bearer ${token}`, accept: 'application/vnd.github+json', 'content-type': 'application/json' },
98
+ body: body && JSON.stringify(body),
99
+ });
100
+ if (!r.ok && !(method === 'POST' && url === '/labels' && r.status === 422)) throw new Error(`${method} ${url}: ${r.status}`);
101
+ return r.status === 204 ? null : r.json();
102
+ };
103
+ return {
104
+ async list() {
105
+ await call('POST', '/labels', { name: LABEL, color: 'ededed' });
106
+ return call('GET', `/issues?labels=${LABEL}&state=all&per_page=100`);
107
+ },
108
+ async comments(number) { return (await call('GET', `/issues/${number}/comments?per_page=100`)).map((c) => c.body); },
109
+ create: (title, body) => call('POST', '/issues', { title, body, labels: [LABEL, 'type: update'] }),
110
+ comment: (number, body) => call('POST', `/issues/${number}/comments`, { body }),
111
+ };
112
+ }
113
+
114
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
115
+ const { GITHUB_TOKEN, GITHUB_REPOSITORY } = process.env;
116
+ if (!GITHUB_TOKEN || !GITHUB_REPOSITORY) { console.error('needs GITHUB_TOKEN and GITHUB_REPOSITORY'); process.exit(1); }
117
+ const pins = JSON.parse(fs.readFileSync(`${ROOT}core/pins.json`, 'utf8')).pins;
118
+ const get = async (url) => {
119
+ const r = await fetch(url, { headers: { accept: 'application/json', authorization: url.includes('api.github.com') ? `Bearer ${GITHUB_TOKEN}` : '' } });
120
+ if (!r.ok) throw new Error(`${url}: ${r.status}`);
121
+ return r.json();
122
+ };
123
+ await run({ pins, get, api: githubApi(GITHUB_REPOSITORY, GITHUB_TOKEN) });
124
+ }