Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,3 +34,4 @@ apps/desktop/bundled-git.json
apps/desktop/resources/tools/
apps/desktop/release/
apps/desktop/release-sources/
packages/cli/release/
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,9 +40,13 @@
"check:stale": "node scripts/check-stale-dist.mjs",
"generate:third-party-notices": "node scripts/generate-third-party-notices.mjs",
"check:third-party-notices": "node scripts/generate-third-party-notices.mjs --check",
"generate:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli",
"check:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli --check",
"release:cli:pack": "node scripts/release-cli-package.mjs",
"release:cli:smoke": "node scripts/smoke-release-cli-package.mjs",
"generate:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs",
"check:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs --check",
"check:release": "npm run check:stale && npm run check:third-party-notices",
"check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && node --test scripts/release-cli-file-policy.test.mjs",
"package:macos-arm64": "node scripts/package-macos-arm64.mjs",
"verify:macos-arm64": "node scripts/verify-macos-arm64-dmg.mjs",
"package:windows-x64": "node scripts/package-windows-x64.mjs",
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
# Maka CLI

Maka is a local-first agent workspace for terminal and desktop workflows. This package installs
the interactive terminal UI and non-interactive CLI.

> **Beta:** the CLI is under active development. Commands and local data formats may change before
> the stable release.

## Install

```bash
npm install --global maka-agent@next
maka
```

`maka-agent` is an alias for `maka`. Node.js 22.19.0 or newer is required.

Use `maka --help` for the supported command surface. `maka eval` additionally requires the
executor environment declared by the selected experiment, such as Docker and Harbor or Pier; the
npm package includes Maka's Eval runtime but does not install those external systems.

## Links

- [Repository](https://github.com/maka-agent/maka-agent)
- [Issues](https://github.com/maka-agent/maka-agent/issues)
- [License](https://github.com/maka-agent/maka-agent/blob/main/LICENSE)
9,494 changes: 9,494 additions & 0 deletions packages/cli/THIRD_PARTY_NOTICES.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "maka-agent",
"version": "0.1.0",
"version": "0.1.0-beta.1",
"license": "Apache-2.0",
"private": true,
"type": "module",
Expand Down
35 changes: 35 additions & 0 deletions packages/cli/src/__tests__/eval-bundle-path.test.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
import assert from 'node:assert/strict';
import { mkdtemp, mkdir, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { describe, test } from 'node:test';
import { configureInstalledEvalBundle } from '../eval-bundle-path.js';

describe('installed Eval bundle', () => {
test('points Eval containers at the installed package root', async (t) => {
const packageRoot = await mkdtemp(join(tmpdir(), 'maka-cli-eval-bundle-'));
t.after(() => rm(packageRoot, { recursive: true, force: true }));
await mkdir(join(packageRoot, 'packages/eval'), { recursive: true });
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, packageRoot);

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, packageRoot);
});

test('preserves an explicit bundle path', () => {
const environment = { MAKA_EVAL_MAKA_BUNDLE_PATH: '/explicit/bundle' };

configureInstalledEvalBundle(environment, '/installed/package');

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, '/explicit/bundle');
});

test('does not change source-checkout behavior without a packaged Eval mirror', () => {
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, '/missing/package');

assert.equal(Object.hasOwn(environment, 'MAKA_EVAL_MAKA_BUNDLE_PATH'), false);
});
});
2 changes: 2 additions & 0 deletions packages/cli/src/cli-core.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -180,6 +180,8 @@ export async function runMakaCli(
return runMakaActivationCli(command.args);
}
case 'eval': {
const { configureInstalledEvalBundle } = await import('./eval-bundle-path.js');
configureInstalledEvalBundle();
const { runMakaEvalCli } = await import('@maka/eval');
return runMakaEvalCli(command.args);
}
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/eval-bundle-path.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
import { statSync } from 'node:fs';
import { resolve } from 'node:path';

const MAKA_EVAL_BUNDLE_ENV = 'MAKA_EVAL_MAKA_BUNDLE_PATH';

export function configureInstalledEvalBundle(
environment: NodeJS.ProcessEnv = process.env,
packageRoot = resolve(import.meta.dirname, '..'),
): void {
if (Object.hasOwn(environment, MAKA_EVAL_BUNDLE_ENV)) return;
try {
if (!statSync(resolve(packageRoot, 'packages/eval')).isDirectory()) return;
} catch {
return;
}
environment[MAKA_EVAL_BUNDLE_ENV] = packageRoot;
}
49 changes: 38 additions & 11 deletions scripts/generate-third-party-notices.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,33 @@ import { join, resolve } from 'node:path';
import { npmSpawnOptions } from './npm-spawn.mjs';

const repoRoot = resolve(import.meta.dirname, '..');
const outputPath = join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt');
const checkOnly = process.argv.includes('--check');
const targetName = (() => {
const index = process.argv.indexOf('--target');
if (index < 0) return 'desktop';
const value = process.argv[index + 1];
if (!value) throw new Error('--target requires desktop or cli');
return value;
})();
const TARGETS = {
desktop: {
workspaceName: '@maka/desktop',
title: 'Maka Desktop — Production npm Third-Party Notices',
underline: '====================================================',
outputPath: join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt'),
validateAssets: true,
},
cli: {
workspaceName: 'maka-agent',
title: 'Maka CLI — Production npm Third-Party Notices',
underline: '=============================================',
outputPath: join(repoRoot, 'packages/cli/THIRD_PARTY_NOTICES.txt'),
validateAssets: false,
},
};
const target = TARGETS[targetName];
if (!target) throw new Error(`Unsupported notice target: ${targetName}`);
const { outputPath } = target;
const assetNoticePath = join(repoRoot, 'apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt');
const REQUIRED_ASSET_NOTICE_MARKERS = [
'## Simple Icons brand marks',
Expand DownExpand Up@@ -78,6 +103,8 @@ const EMBEDDED_COMPONENT_LICENSES = new Map([
],
]);
const MIT_COPYRIGHT_OVERRIDES = new Map([
// The published tarball omits the monorepo-root LICENSE.
['@earendil-works/pi-tui@0.83.0', 'Copyright (c) 2025 Mario Zechner'],
// The published tarball omits the repository LICENSE; sibling @astryxdesign
// packages ship it verbatim with this notice.
['@astryxdesign/core@0.1.9', 'Copyright (c) 2026 Meta Platforms, Inc.'],
Expand DownExpand Up@@ -137,20 +164,20 @@ function normalizeText(text) {
.trim();
}

function collectDesktopClosure() {
function collectWorkspaceClosure(workspaceName) {
const tree = JSON.parse(
execFileSync(
'npm',
['ls', '--workspace', '@maka/desktop', '--omit=dev', '--all', '--json'],
['ls', '--workspace', workspaceName, '--omit=dev', '--all', '--json'],
npmSpawnOptions({
cwd: repoRoot,
encoding: 'utf8',
maxBuffer: 16 * 1024 * 1024,
}),
),
);
const desktop = tree.dependencies?.['@maka/desktop'];
if (!desktop) throw new Error('npm ls did not return the @maka/desktop workspace');
const workspace = tree.dependencies?.[workspaceName];
if (!workspace) throw new Error(`npm ls did not return the ${workspaceName} workspace`);

const packages = new Map();
const visit = (dependencies) => {
Expand All@@ -165,7 +192,7 @@ function collectDesktopClosure() {
visit(dependency.dependencies);
}
};
visit(desktop.dependencies);
visit(workspace.dependencies);
return [...packages.values()].sort(
(left, right) =>
left.name.localeCompare(right.name) || left.version.localeCompare(right.version),
Expand DownExpand Up@@ -236,7 +263,7 @@ function overrideLicenseText(packageKey, selectedLicense) {
function renderNotice() {
const lockIndex = buildLockIndex();
const sections = [];
const dependencies = collectDesktopClosure();
const dependencies = collectWorkspaceClosure(target.workspaceName);
for (const dependency of dependencies) {
const packageKey = `${dependency.name}@${dependency.version}`;
const candidates = lockIndex.get(packageKey);
Expand DownExpand Up@@ -303,11 +330,11 @@ function renderNotice() {
}
}

return `Maka Desktop — Production npm Third-Party Notices
====================================================
return `${target.title}
${target.underline}

Generated by scripts/generate-third-party-notices.mjs from the exact
@maka/desktop production dependency closure and package-lock.json.
${target.workspaceName} production dependency closure and package-lock.json.
Do not edit this file by hand.

Policy: every package must resolve to an ASF-compatible SPDX license. Compound
Expand DownExpand Up@@ -396,7 +423,7 @@ function describeNoticeDrift(committed, generated) {
return lines.join('\n');
}

validateAssetNotices();
if (target.validateAssets) validateAssetNotices();
const generated = renderNotice();
if (checkOnly) {
if (!existsSync(outputPath)) {
Expand Down
38 changes: 38 additions & 0 deletions scripts/release-cli-file-policy.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
const DEVELOPMENT_DIRECTORIES = new Set([
'.nyc_output',
'__fixtures__',
'__tests__',
'coverage',
'fixture',
'fixtures',
'test',
'tests',
]);

export function isThirdPartyDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
/\.(?:spec|test)\.(?:cjs|js|mjs)$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.(?:cjs|js|mjs)\.map$/.test(file) ||
/\.(?:cts|mts|ts|tsx)$/.test(file) ||
file.endsWith('.tsbuildinfo')
);
}

export function isMakaDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => segment === 'src')) return true;
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
file === 'dev-cli.js' ||
/\.(?:spec|test)\.js$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.js\.map$/.test(file)
);
}
41 changes: 41 additions & 0 deletions scripts/release-cli-file-policy.test.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
isMakaDevelopmentArtifact,
isThirdPartyDevelopmentArtifact,
} from './release-cli-file-policy.mjs';

describe('CLI release file policy', () => {
test('rejects third-party development artifacts on every platform', () => {
for (const path of [
'coverage/lcov.info',
'test/fixture/input.json',
'lib/parser.test.js',
'dist/index.d.ts',
'dist/index.js.map',
String.raw`fixtures\windows.json`,
'src/index.ts',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), true, path);
}
});

test('preserves third-party runtime source and native assets', () => {
for (const path of [
'src/index.js',
'dist/index.js',
'prebuilds/darwin-arm64/pty.node',
'prebuilds/win32-x64/conpty/OpenConsole.exe',
'LICENSE',
'package.json',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), false, path);
}
});

test('keeps the stricter Maka-owned package boundary', () => {
assert.equal(isMakaDevelopmentArtifact('src/index.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/__tests__/fixture.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/index.js'), false);
});
});
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,3 +34,4 @@ apps/desktop/bundled-git.json
apps/desktop/resources/tools/
apps/desktop/release/
apps/desktop/release-sources/
packages/cli/release/
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,9 +40,13 @@
"check:stale": "node scripts/check-stale-dist.mjs",
"generate:third-party-notices": "node scripts/generate-third-party-notices.mjs",
"check:third-party-notices": "node scripts/generate-third-party-notices.mjs --check",
"generate:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli",
"check:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli --check",
"release:cli:pack": "node scripts/release-cli-package.mjs",
"release:cli:smoke": "node scripts/smoke-release-cli-package.mjs",
"generate:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs",
"check:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs --check",
"check:release": "npm run check:stale && npm run check:third-party-notices",
"check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && node --test scripts/release-cli-file-policy.test.mjs",
"package:macos-arm64": "node scripts/package-macos-arm64.mjs",
"verify:macos-arm64": "node scripts/verify-macos-arm64-dmg.mjs",
"package:windows-x64": "node scripts/package-windows-x64.mjs",
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
# Maka CLI

Maka is a local-first agent workspace for terminal and desktop workflows. This package installs
the interactive terminal UI and non-interactive CLI.

> **Beta:** the CLI is under active development. Commands and local data formats may change before
> the stable release.

## Install

```bash
npm install --global maka-agent@next
maka
```

`maka-agent` is an alias for `maka`. Node.js 22.19.0 or newer is required.

Use `maka --help` for the supported command surface. `maka eval` additionally requires the
executor environment declared by the selected experiment, such as Docker and Harbor or Pier; the
npm package includes Maka's Eval runtime but does not install those external systems.

## Links

- [Repository](https://github.com/maka-agent/maka-agent)
- [Issues](https://github.com/maka-agent/maka-agent/issues)
- [License](https://github.com/maka-agent/maka-agent/blob/main/LICENSE)
9,494 changes: 9,494 additions & 0 deletions packages/cli/THIRD_PARTY_NOTICES.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "maka-agent",
"version": "0.1.0",
"version": "0.1.0-beta.1",
"license": "Apache-2.0",
"private": true,
"type": "module",
Expand Down
35 changes: 35 additions & 0 deletions packages/cli/src/__tests__/eval-bundle-path.test.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
import assert from 'node:assert/strict';
import { mkdtemp, mkdir, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { describe, test } from 'node:test';
import { configureInstalledEvalBundle } from '../eval-bundle-path.js';

describe('installed Eval bundle', () => {
test('points Eval containers at the installed package root', async (t) => {
const packageRoot = await mkdtemp(join(tmpdir(), 'maka-cli-eval-bundle-'));
t.after(() => rm(packageRoot, { recursive: true, force: true }));
await mkdir(join(packageRoot, 'packages/eval'), { recursive: true });
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, packageRoot);

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, packageRoot);
});

test('preserves an explicit bundle path', () => {
const environment = { MAKA_EVAL_MAKA_BUNDLE_PATH: '/explicit/bundle' };

configureInstalledEvalBundle(environment, '/installed/package');

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, '/explicit/bundle');
});

test('does not change source-checkout behavior without a packaged Eval mirror', () => {
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, '/missing/package');

assert.equal(Object.hasOwn(environment, 'MAKA_EVAL_MAKA_BUNDLE_PATH'), false);
});
});
2 changes: 2 additions & 0 deletions packages/cli/src/cli-core.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -180,6 +180,8 @@ export async function runMakaCli(
return runMakaActivationCli(command.args);
}
case 'eval': {
const { configureInstalledEvalBundle } = await import('./eval-bundle-path.js');
configureInstalledEvalBundle();
const { runMakaEvalCli } = await import('@maka/eval');
return runMakaEvalCli(command.args);
}
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/eval-bundle-path.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
import { statSync } from 'node:fs';
import { resolve } from 'node:path';

const MAKA_EVAL_BUNDLE_ENV = 'MAKA_EVAL_MAKA_BUNDLE_PATH';

export function configureInstalledEvalBundle(
environment: NodeJS.ProcessEnv = process.env,
packageRoot = resolve(import.meta.dirname, '..'),
): void {
if (Object.hasOwn(environment, MAKA_EVAL_BUNDLE_ENV)) return;
try {
if (!statSync(resolve(packageRoot, 'packages/eval')).isDirectory()) return;
} catch {
return;
}
environment[MAKA_EVAL_BUNDLE_ENV] = packageRoot;
}
49 changes: 38 additions & 11 deletions scripts/generate-third-party-notices.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,33 @@ import { join, resolve } from 'node:path';
import { npmSpawnOptions } from './npm-spawn.mjs';

const repoRoot = resolve(import.meta.dirname, '..');
const outputPath = join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt');
const checkOnly = process.argv.includes('--check');
const targetName = (() => {
const index = process.argv.indexOf('--target');
if (index < 0) return 'desktop';
const value = process.argv[index + 1];
if (!value) throw new Error('--target requires desktop or cli');
return value;
})();
const TARGETS = {
desktop: {
workspaceName: '@maka/desktop',
title: 'Maka Desktop — Production npm Third-Party Notices',
underline: '====================================================',
outputPath: join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt'),
validateAssets: true,
},
cli: {
workspaceName: 'maka-agent',
title: 'Maka CLI — Production npm Third-Party Notices',
underline: '=============================================',
outputPath: join(repoRoot, 'packages/cli/THIRD_PARTY_NOTICES.txt'),
validateAssets: false,
},
};
const target = TARGETS[targetName];
if (!target) throw new Error(`Unsupported notice target: ${targetName}`);
const { outputPath } = target;
const assetNoticePath = join(repoRoot, 'apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt');
const REQUIRED_ASSET_NOTICE_MARKERS = [
'## Simple Icons brand marks',
Expand DownExpand Up@@ -78,6 +103,8 @@ const EMBEDDED_COMPONENT_LICENSES = new Map([
],
]);
const MIT_COPYRIGHT_OVERRIDES = new Map([
// The published tarball omits the monorepo-root LICENSE.
['@earendil-works/pi-tui@0.83.0', 'Copyright (c) 2025 Mario Zechner'],
// The published tarball omits the repository LICENSE; sibling @astryxdesign
// packages ship it verbatim with this notice.
['@astryxdesign/core@0.1.9', 'Copyright (c) 2026 Meta Platforms, Inc.'],
Expand DownExpand Up@@ -137,20 +164,20 @@ function normalizeText(text) {
.trim();
}

function collectDesktopClosure() {
function collectWorkspaceClosure(workspaceName) {
const tree = JSON.parse(
execFileSync(
'npm',
['ls', '--workspace', '@maka/desktop', '--omit=dev', '--all', '--json'],
['ls', '--workspace', workspaceName, '--omit=dev', '--all', '--json'],
npmSpawnOptions({
cwd: repoRoot,
encoding: 'utf8',
maxBuffer: 16 * 1024 * 1024,
}),
),
);
const desktop = tree.dependencies?.['@maka/desktop'];
if (!desktop) throw new Error('npm ls did not return the @maka/desktop workspace');
const workspace = tree.dependencies?.[workspaceName];
if (!workspace) throw new Error(`npm ls did not return the ${workspaceName} workspace`);

const packages = new Map();
const visit = (dependencies) => {
Expand All@@ -165,7 +192,7 @@ function collectDesktopClosure() {
visit(dependency.dependencies);
}
};
visit(desktop.dependencies);
visit(workspace.dependencies);
return [...packages.values()].sort(
(left, right) =>
left.name.localeCompare(right.name) || left.version.localeCompare(right.version),
Expand DownExpand Up@@ -236,7 +263,7 @@ function overrideLicenseText(packageKey, selectedLicense) {
function renderNotice() {
const lockIndex = buildLockIndex();
const sections = [];
const dependencies = collectDesktopClosure();
const dependencies = collectWorkspaceClosure(target.workspaceName);
for (const dependency of dependencies) {
const packageKey = `${dependency.name}@${dependency.version}`;
const candidates = lockIndex.get(packageKey);
Expand DownExpand Up@@ -303,11 +330,11 @@ function renderNotice() {
}
}

return `Maka Desktop — Production npm Third-Party Notices
====================================================
return `${target.title}
${target.underline}

Generated by scripts/generate-third-party-notices.mjs from the exact
@maka/desktop production dependency closure and package-lock.json.
${target.workspaceName} production dependency closure and package-lock.json.
Do not edit this file by hand.

Policy: every package must resolve to an ASF-compatible SPDX license. Compound
Expand DownExpand Up@@ -396,7 +423,7 @@ function describeNoticeDrift(committed, generated) {
return lines.join('\n');
}

validateAssetNotices();
if (target.validateAssets) validateAssetNotices();
const generated = renderNotice();
if (checkOnly) {
if (!existsSync(outputPath)) {
Expand Down
38 changes: 38 additions & 0 deletions scripts/release-cli-file-policy.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
const DEVELOPMENT_DIRECTORIES = new Set([
'.nyc_output',
'__fixtures__',
'__tests__',
'coverage',
'fixture',
'fixtures',
'test',
'tests',
]);

export function isThirdPartyDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
/\.(?:spec|test)\.(?:cjs|js|mjs)$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.(?:cjs|js|mjs)\.map$/.test(file) ||
/\.(?:cts|mts|ts|tsx)$/.test(file) ||
file.endsWith('.tsbuildinfo')
);
}

export function isMakaDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => segment === 'src')) return true;
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
file === 'dev-cli.js' ||
/\.(?:spec|test)\.js$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.js\.map$/.test(file)
);
}
41 changes: 41 additions & 0 deletions scripts/release-cli-file-policy.test.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
isMakaDevelopmentArtifact,
isThirdPartyDevelopmentArtifact,
} from './release-cli-file-policy.mjs';

describe('CLI release file policy', () => {
test('rejects third-party development artifacts on every platform', () => {
for (const path of [
'coverage/lcov.info',
'test/fixture/input.json',
'lib/parser.test.js',
'dist/index.d.ts',
'dist/index.js.map',
String.raw`fixtures\windows.json`,
'src/index.ts',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), true, path);
}
});

test('preserves third-party runtime source and native assets', () => {
for (const path of [
'src/index.js',
'dist/index.js',
'prebuilds/darwin-arm64/pty.node',
'prebuilds/win32-x64/conpty/OpenConsole.exe',
'LICENSE',
'package.json',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), false, path);
}
});

test('keeps the stricter Maka-owned package boundary', () => {
assert.equal(isMakaDevelopmentArtifact('src/index.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/__tests__/fixture.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/index.js'), false);
});
});
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,3 +34,4 @@ apps/desktop/bundled-git.json
apps/desktop/resources/tools/
apps/desktop/release/
apps/desktop/release-sources/
packages/cli/release/
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,9 +40,13 @@
"check:stale": "node scripts/check-stale-dist.mjs",
"generate:third-party-notices": "node scripts/generate-third-party-notices.mjs",
"check:third-party-notices": "node scripts/generate-third-party-notices.mjs --check",
"generate:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli",
"check:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli --check",
"release:cli:pack": "node scripts/release-cli-package.mjs",
"release:cli:smoke": "node scripts/smoke-release-cli-package.mjs",
"generate:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs",
"check:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs --check",
"check:release": "npm run check:stale && npm run check:third-party-notices",
"check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && node --test scripts/release-cli-file-policy.test.mjs",
"package:macos-arm64": "node scripts/package-macos-arm64.mjs",
"verify:macos-arm64": "node scripts/verify-macos-arm64-dmg.mjs",
"package:windows-x64": "node scripts/package-windows-x64.mjs",
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
# Maka CLI

Maka is a local-first agent workspace for terminal and desktop workflows. This package installs
the interactive terminal UI and non-interactive CLI.

> **Beta:** the CLI is under active development. Commands and local data formats may change before
> the stable release.

## Install

```bash
npm install --global maka-agent@next
maka
```

`maka-agent` is an alias for `maka`. Node.js 22.19.0 or newer is required.

Use `maka --help` for the supported command surface. `maka eval` additionally requires the
executor environment declared by the selected experiment, such as Docker and Harbor or Pier; the
npm package includes Maka's Eval runtime but does not install those external systems.

## Links

- [Repository](https://github.com/maka-agent/maka-agent)
- [Issues](https://github.com/maka-agent/maka-agent/issues)
- [License](https://github.com/maka-agent/maka-agent/blob/main/LICENSE)
9,494 changes: 9,494 additions & 0 deletions packages/cli/THIRD_PARTY_NOTICES.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "maka-agent",
"version": "0.1.0",
"version": "0.1.0-beta.1",
"license": "Apache-2.0",
"private": true,
"type": "module",
Expand Down
35 changes: 35 additions & 0 deletions packages/cli/src/__tests__/eval-bundle-path.test.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
import assert from 'node:assert/strict';
import { mkdtemp, mkdir, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { describe, test } from 'node:test';
import { configureInstalledEvalBundle } from '../eval-bundle-path.js';

describe('installed Eval bundle', () => {
test('points Eval containers at the installed package root', async (t) => {
const packageRoot = await mkdtemp(join(tmpdir(), 'maka-cli-eval-bundle-'));
t.after(() => rm(packageRoot, { recursive: true, force: true }));
await mkdir(join(packageRoot, 'packages/eval'), { recursive: true });
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, packageRoot);

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, packageRoot);
});

test('preserves an explicit bundle path', () => {
const environment = { MAKA_EVAL_MAKA_BUNDLE_PATH: '/explicit/bundle' };

configureInstalledEvalBundle(environment, '/installed/package');

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, '/explicit/bundle');
});

test('does not change source-checkout behavior without a packaged Eval mirror', () => {
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, '/missing/package');

assert.equal(Object.hasOwn(environment, 'MAKA_EVAL_MAKA_BUNDLE_PATH'), false);
});
});
2 changes: 2 additions & 0 deletions packages/cli/src/cli-core.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -180,6 +180,8 @@ export async function runMakaCli(
return runMakaActivationCli(command.args);
}
case 'eval': {
const { configureInstalledEvalBundle } = await import('./eval-bundle-path.js');
configureInstalledEvalBundle();
const { runMakaEvalCli } = await import('@maka/eval');
return runMakaEvalCli(command.args);
}
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/eval-bundle-path.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
import { statSync } from 'node:fs';
import { resolve } from 'node:path';

const MAKA_EVAL_BUNDLE_ENV = 'MAKA_EVAL_MAKA_BUNDLE_PATH';

export function configureInstalledEvalBundle(
environment: NodeJS.ProcessEnv = process.env,
packageRoot = resolve(import.meta.dirname, '..'),
): void {
if (Object.hasOwn(environment, MAKA_EVAL_BUNDLE_ENV)) return;
try {
if (!statSync(resolve(packageRoot, 'packages/eval')).isDirectory()) return;
} catch {
return;
}
environment[MAKA_EVAL_BUNDLE_ENV] = packageRoot;
}
49 changes: 38 additions & 11 deletions scripts/generate-third-party-notices.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,33 @@ import { join, resolve } from 'node:path';
import { npmSpawnOptions } from './npm-spawn.mjs';

const repoRoot = resolve(import.meta.dirname, '..');
const outputPath = join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt');
const checkOnly = process.argv.includes('--check');
const targetName = (() => {
const index = process.argv.indexOf('--target');
if (index < 0) return 'desktop';
const value = process.argv[index + 1];
if (!value) throw new Error('--target requires desktop or cli');
return value;
})();
const TARGETS = {
desktop: {
workspaceName: '@maka/desktop',
title: 'Maka Desktop — Production npm Third-Party Notices',
underline: '====================================================',
outputPath: join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt'),
validateAssets: true,
},
cli: {
workspaceName: 'maka-agent',
title: 'Maka CLI — Production npm Third-Party Notices',
underline: '=============================================',
outputPath: join(repoRoot, 'packages/cli/THIRD_PARTY_NOTICES.txt'),
validateAssets: false,
},
};
const target = TARGETS[targetName];
if (!target) throw new Error(`Unsupported notice target: ${targetName}`);
const { outputPath } = target;
const assetNoticePath = join(repoRoot, 'apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt');
const REQUIRED_ASSET_NOTICE_MARKERS = [
'## Simple Icons brand marks',
Expand DownExpand Up@@ -78,6 +103,8 @@ const EMBEDDED_COMPONENT_LICENSES = new Map([
],
]);
const MIT_COPYRIGHT_OVERRIDES = new Map([
// The published tarball omits the monorepo-root LICENSE.
['@earendil-works/pi-tui@0.83.0', 'Copyright (c) 2025 Mario Zechner'],
// The published tarball omits the repository LICENSE; sibling @astryxdesign
// packages ship it verbatim with this notice.
['@astryxdesign/core@0.1.9', 'Copyright (c) 2026 Meta Platforms, Inc.'],
Expand DownExpand Up@@ -137,20 +164,20 @@ function normalizeText(text) {
.trim();
}

function collectDesktopClosure() {
function collectWorkspaceClosure(workspaceName) {
const tree = JSON.parse(
execFileSync(
'npm',
['ls', '--workspace', '@maka/desktop', '--omit=dev', '--all', '--json'],
['ls', '--workspace', workspaceName, '--omit=dev', '--all', '--json'],
npmSpawnOptions({
cwd: repoRoot,
encoding: 'utf8',
maxBuffer: 16 * 1024 * 1024,
}),
),
);
const desktop = tree.dependencies?.['@maka/desktop'];
if (!desktop) throw new Error('npm ls did not return the @maka/desktop workspace');
const workspace = tree.dependencies?.[workspaceName];
if (!workspace) throw new Error(`npm ls did not return the ${workspaceName} workspace`);

const packages = new Map();
const visit = (dependencies) => {
Expand All@@ -165,7 +192,7 @@ function collectDesktopClosure() {
visit(dependency.dependencies);
}
};
visit(desktop.dependencies);
visit(workspace.dependencies);
return [...packages.values()].sort(
(left, right) =>
left.name.localeCompare(right.name) || left.version.localeCompare(right.version),
Expand DownExpand Up@@ -236,7 +263,7 @@ function overrideLicenseText(packageKey, selectedLicense) {
function renderNotice() {
const lockIndex = buildLockIndex();
const sections = [];
const dependencies = collectDesktopClosure();
const dependencies = collectWorkspaceClosure(target.workspaceName);
for (const dependency of dependencies) {
const packageKey = `${dependency.name}@${dependency.version}`;
const candidates = lockIndex.get(packageKey);
Expand DownExpand Up@@ -303,11 +330,11 @@ function renderNotice() {
}
}

return `Maka Desktop — Production npm Third-Party Notices
====================================================
return `${target.title}
${target.underline}

Generated by scripts/generate-third-party-notices.mjs from the exact
@maka/desktop production dependency closure and package-lock.json.
${target.workspaceName} production dependency closure and package-lock.json.
Do not edit this file by hand.

Policy: every package must resolve to an ASF-compatible SPDX license. Compound
Expand DownExpand Up@@ -396,7 +423,7 @@ function describeNoticeDrift(committed, generated) {
return lines.join('\n');
}

validateAssetNotices();
if (target.validateAssets) validateAssetNotices();
const generated = renderNotice();
if (checkOnly) {
if (!existsSync(outputPath)) {
Expand Down
38 changes: 38 additions & 0 deletions scripts/release-cli-file-policy.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
const DEVELOPMENT_DIRECTORIES = new Set([
'.nyc_output',
'__fixtures__',
'__tests__',
'coverage',
'fixture',
'fixtures',
'test',
'tests',
]);

export function isThirdPartyDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
/\.(?:spec|test)\.(?:cjs|js|mjs)$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.(?:cjs|js|mjs)\.map$/.test(file) ||
/\.(?:cts|mts|ts|tsx)$/.test(file) ||
file.endsWith('.tsbuildinfo')
);
}

export function isMakaDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => segment === 'src')) return true;
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
file === 'dev-cli.js' ||
/\.(?:spec|test)\.js$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.js\.map$/.test(file)
);
}
41 changes: 41 additions & 0 deletions scripts/release-cli-file-policy.test.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
isMakaDevelopmentArtifact,
isThirdPartyDevelopmentArtifact,
} from './release-cli-file-policy.mjs';

describe('CLI release file policy', () => {
test('rejects third-party development artifacts on every platform', () => {
for (const path of [
'coverage/lcov.info',
'test/fixture/input.json',
'lib/parser.test.js',
'dist/index.d.ts',
'dist/index.js.map',
String.raw`fixtures\windows.json`,
'src/index.ts',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), true, path);
}
});

test('preserves third-party runtime source and native assets', () => {
for (const path of [
'src/index.js',
'dist/index.js',
'prebuilds/darwin-arm64/pty.node',
'prebuilds/win32-x64/conpty/OpenConsole.exe',
'LICENSE',
'package.json',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), false, path);
}
});

test('keeps the stricter Maka-owned package boundary', () => {
assert.equal(isMakaDevelopmentArtifact('src/index.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/__tests__/fixture.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/index.js'), false);
});
});
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,3 +34,4 @@ apps/desktop/bundled-git.json
apps/desktop/resources/tools/
apps/desktop/release/
apps/desktop/release-sources/
packages/cli/release/
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,9 +40,13 @@
"check:stale": "node scripts/check-stale-dist.mjs",
"generate:third-party-notices": "node scripts/generate-third-party-notices.mjs",
"check:third-party-notices": "node scripts/generate-third-party-notices.mjs --check",
"generate:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli",
"check:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli --check",
"release:cli:pack": "node scripts/release-cli-package.mjs",
"release:cli:smoke": "node scripts/smoke-release-cli-package.mjs",
"generate:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs",
"check:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs --check",
"check:release": "npm run check:stale && npm run check:third-party-notices",
"check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && node --test scripts/release-cli-file-policy.test.mjs",
"package:macos-arm64": "node scripts/package-macos-arm64.mjs",
"verify:macos-arm64": "node scripts/verify-macos-arm64-dmg.mjs",
"package:windows-x64": "node scripts/package-windows-x64.mjs",
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
# Maka CLI

Maka is a local-first agent workspace for terminal and desktop workflows. This package installs
the interactive terminal UI and non-interactive CLI.

> **Beta:** the CLI is under active development. Commands and local data formats may change before
> the stable release.

## Install

```bash
npm install --global maka-agent@next
maka
```

`maka-agent` is an alias for `maka`. Node.js 22.19.0 or newer is required.

Use `maka --help` for the supported command surface. `maka eval` additionally requires the
executor environment declared by the selected experiment, such as Docker and Harbor or Pier; the
npm package includes Maka's Eval runtime but does not install those external systems.

## Links

- [Repository](https://github.com/maka-agent/maka-agent)
- [Issues](https://github.com/maka-agent/maka-agent/issues)
- [License](https://github.com/maka-agent/maka-agent/blob/main/LICENSE)
9,494 changes: 9,494 additions & 0 deletions packages/cli/THIRD_PARTY_NOTICES.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "maka-agent",
"version": "0.1.0",
"version": "0.1.0-beta.1",
"license": "Apache-2.0",
"private": true,
"type": "module",
Expand Down
35 changes: 35 additions & 0 deletions packages/cli/src/__tests__/eval-bundle-path.test.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
import assert from 'node:assert/strict';
import { mkdtemp, mkdir, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { describe, test } from 'node:test';
import { configureInstalledEvalBundle } from '../eval-bundle-path.js';

describe('installed Eval bundle', () => {
test('points Eval containers at the installed package root', async (t) => {
const packageRoot = await mkdtemp(join(tmpdir(), 'maka-cli-eval-bundle-'));
t.after(() => rm(packageRoot, { recursive: true, force: true }));
await mkdir(join(packageRoot, 'packages/eval'), { recursive: true });
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, packageRoot);

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, packageRoot);
});

test('preserves an explicit bundle path', () => {
const environment = { MAKA_EVAL_MAKA_BUNDLE_PATH: '/explicit/bundle' };

configureInstalledEvalBundle(environment, '/installed/package');

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, '/explicit/bundle');
});

test('does not change source-checkout behavior without a packaged Eval mirror', () => {
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, '/missing/package');

assert.equal(Object.hasOwn(environment, 'MAKA_EVAL_MAKA_BUNDLE_PATH'), false);
});
});
2 changes: 2 additions & 0 deletions packages/cli/src/cli-core.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -180,6 +180,8 @@ export async function runMakaCli(
return runMakaActivationCli(command.args);
}
case 'eval': {
const { configureInstalledEvalBundle } = await import('./eval-bundle-path.js');
configureInstalledEvalBundle();
const { runMakaEvalCli } = await import('@maka/eval');
return runMakaEvalCli(command.args);
}
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/eval-bundle-path.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
import { statSync } from 'node:fs';
import { resolve } from 'node:path';

const MAKA_EVAL_BUNDLE_ENV = 'MAKA_EVAL_MAKA_BUNDLE_PATH';

export function configureInstalledEvalBundle(
environment: NodeJS.ProcessEnv = process.env,
packageRoot = resolve(import.meta.dirname, '..'),
): void {
if (Object.hasOwn(environment, MAKA_EVAL_BUNDLE_ENV)) return;
try {
if (!statSync(resolve(packageRoot, 'packages/eval')).isDirectory()) return;
} catch {
return;
}
environment[MAKA_EVAL_BUNDLE_ENV] = packageRoot;
}
49 changes: 38 additions & 11 deletions scripts/generate-third-party-notices.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,33 @@ import { join, resolve } from 'node:path';
import { npmSpawnOptions } from './npm-spawn.mjs';

const repoRoot = resolve(import.meta.dirname, '..');
const outputPath = join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt');
const checkOnly = process.argv.includes('--check');
const targetName = (() => {
const index = process.argv.indexOf('--target');
if (index < 0) return 'desktop';
const value = process.argv[index + 1];
if (!value) throw new Error('--target requires desktop or cli');
return value;
})();
const TARGETS = {
desktop: {
workspaceName: '@maka/desktop',
title: 'Maka Desktop — Production npm Third-Party Notices',
underline: '====================================================',
outputPath: join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt'),
validateAssets: true,
},
cli: {
workspaceName: 'maka-agent',
title: 'Maka CLI — Production npm Third-Party Notices',
underline: '=============================================',
outputPath: join(repoRoot, 'packages/cli/THIRD_PARTY_NOTICES.txt'),
validateAssets: false,
},
};
const target = TARGETS[targetName];
if (!target) throw new Error(`Unsupported notice target: ${targetName}`);
const { outputPath } = target;
const assetNoticePath = join(repoRoot, 'apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt');
const REQUIRED_ASSET_NOTICE_MARKERS = [
'## Simple Icons brand marks',
Expand DownExpand Up@@ -78,6 +103,8 @@ const EMBEDDED_COMPONENT_LICENSES = new Map([
],
]);
const MIT_COPYRIGHT_OVERRIDES = new Map([
// The published tarball omits the monorepo-root LICENSE.
['@earendil-works/pi-tui@0.83.0', 'Copyright (c) 2025 Mario Zechner'],
// The published tarball omits the repository LICENSE; sibling @astryxdesign
// packages ship it verbatim with this notice.
['@astryxdesign/core@0.1.9', 'Copyright (c) 2026 Meta Platforms, Inc.'],
Expand DownExpand Up@@ -137,20 +164,20 @@ function normalizeText(text) {
.trim();
}

function collectDesktopClosure() {
function collectWorkspaceClosure(workspaceName) {
const tree = JSON.parse(
execFileSync(
'npm',
['ls', '--workspace', '@maka/desktop', '--omit=dev', '--all', '--json'],
['ls', '--workspace', workspaceName, '--omit=dev', '--all', '--json'],
npmSpawnOptions({
cwd: repoRoot,
encoding: 'utf8',
maxBuffer: 16 * 1024 * 1024,
}),
),
);
const desktop = tree.dependencies?.['@maka/desktop'];
if (!desktop) throw new Error('npm ls did not return the @maka/desktop workspace');
const workspace = tree.dependencies?.[workspaceName];
if (!workspace) throw new Error(`npm ls did not return the ${workspaceName} workspace`);

const packages = new Map();
const visit = (dependencies) => {
Expand All@@ -165,7 +192,7 @@ function collectDesktopClosure() {
visit(dependency.dependencies);
}
};
visit(desktop.dependencies);
visit(workspace.dependencies);
return [...packages.values()].sort(
(left, right) =>
left.name.localeCompare(right.name) || left.version.localeCompare(right.version),
Expand DownExpand Up@@ -236,7 +263,7 @@ function overrideLicenseText(packageKey, selectedLicense) {
function renderNotice() {
const lockIndex = buildLockIndex();
const sections = [];
const dependencies = collectDesktopClosure();
const dependencies = collectWorkspaceClosure(target.workspaceName);
for (const dependency of dependencies) {
const packageKey = `${dependency.name}@${dependency.version}`;
const candidates = lockIndex.get(packageKey);
Expand DownExpand Up@@ -303,11 +330,11 @@ function renderNotice() {
}
}

return `Maka Desktop — Production npm Third-Party Notices
====================================================
return `${target.title}
${target.underline}

Generated by scripts/generate-third-party-notices.mjs from the exact
@maka/desktop production dependency closure and package-lock.json.
${target.workspaceName} production dependency closure and package-lock.json.
Do not edit this file by hand.

Policy: every package must resolve to an ASF-compatible SPDX license. Compound
Expand DownExpand Up@@ -396,7 +423,7 @@ function describeNoticeDrift(committed, generated) {
return lines.join('\n');
}

validateAssetNotices();
if (target.validateAssets) validateAssetNotices();
const generated = renderNotice();
if (checkOnly) {
if (!existsSync(outputPath)) {
Expand Down
38 changes: 38 additions & 0 deletions scripts/release-cli-file-policy.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
const DEVELOPMENT_DIRECTORIES = new Set([
'.nyc_output',
'__fixtures__',
'__tests__',
'coverage',
'fixture',
'fixtures',
'test',
'tests',
]);

export function isThirdPartyDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
/\.(?:spec|test)\.(?:cjs|js|mjs)$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.(?:cjs|js|mjs)\.map$/.test(file) ||
/\.(?:cts|mts|ts|tsx)$/.test(file) ||
file.endsWith('.tsbuildinfo')
);
}

export function isMakaDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => segment === 'src')) return true;
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
file === 'dev-cli.js' ||
/\.(?:spec|test)\.js$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.js\.map$/.test(file)
);
}
41 changes: 41 additions & 0 deletions scripts/release-cli-file-policy.test.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
isMakaDevelopmentArtifact,
isThirdPartyDevelopmentArtifact,
} from './release-cli-file-policy.mjs';

describe('CLI release file policy', () => {
test('rejects third-party development artifacts on every platform', () => {
for (const path of [
'coverage/lcov.info',
'test/fixture/input.json',
'lib/parser.test.js',
'dist/index.d.ts',
'dist/index.js.map',
String.raw`fixtures\windows.json`,
'src/index.ts',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), true, path);
}
});

test('preserves third-party runtime source and native assets', () => {
for (const path of [
'src/index.js',
'dist/index.js',
'prebuilds/darwin-arm64/pty.node',
'prebuilds/win32-x64/conpty/OpenConsole.exe',
'LICENSE',
'package.json',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), false, path);
}
});

test('keeps the stricter Maka-owned package boundary', () => {
assert.equal(isMakaDevelopmentArtifact('src/index.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/__tests__/fixture.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/index.js'), false);
});
});
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,3 +34,4 @@ apps/desktop/bundled-git.json
apps/desktop/resources/tools/
apps/desktop/release/
apps/desktop/release-sources/
packages/cli/release/
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,9 +40,13 @@
"check:stale": "node scripts/check-stale-dist.mjs",
"generate:third-party-notices": "node scripts/generate-third-party-notices.mjs",
"check:third-party-notices": "node scripts/generate-third-party-notices.mjs --check",
"generate:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli",
"check:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli --check",
"release:cli:pack": "node scripts/release-cli-package.mjs",
"release:cli:smoke": "node scripts/smoke-release-cli-package.mjs",
"generate:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs",
"check:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs --check",
"check:release": "npm run check:stale && npm run check:third-party-notices",
"check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && node --test scripts/release-cli-file-policy.test.mjs",
"package:macos-arm64": "node scripts/package-macos-arm64.mjs",
"verify:macos-arm64": "node scripts/verify-macos-arm64-dmg.mjs",
"package:windows-x64": "node scripts/package-windows-x64.mjs",
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
# Maka CLI

Maka is a local-first agent workspace for terminal and desktop workflows. This package installs
the interactive terminal UI and non-interactive CLI.

> **Beta:** the CLI is under active development. Commands and local data formats may change before
> the stable release.

## Install

```bash
npm install --global maka-agent@next
maka
```

`maka-agent` is an alias for `maka`. Node.js 22.19.0 or newer is required.

Use `maka --help` for the supported command surface. `maka eval` additionally requires the
executor environment declared by the selected experiment, such as Docker and Harbor or Pier; the
npm package includes Maka's Eval runtime but does not install those external systems.

## Links

- [Repository](https://github.com/maka-agent/maka-agent)
- [Issues](https://github.com/maka-agent/maka-agent/issues)
- [License](https://github.com/maka-agent/maka-agent/blob/main/LICENSE)
9,494 changes: 9,494 additions & 0 deletions packages/cli/THIRD_PARTY_NOTICES.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "maka-agent",
"version": "0.1.0",
"version": "0.1.0-beta.1",
"license": "Apache-2.0",
"private": true,
"type": "module",
Expand Down
35 changes: 35 additions & 0 deletions packages/cli/src/__tests__/eval-bundle-path.test.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
import assert from 'node:assert/strict';
import { mkdtemp, mkdir, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { describe, test } from 'node:test';
import { configureInstalledEvalBundle } from '../eval-bundle-path.js';

describe('installed Eval bundle', () => {
test('points Eval containers at the installed package root', async (t) => {
const packageRoot = await mkdtemp(join(tmpdir(), 'maka-cli-eval-bundle-'));
t.after(() => rm(packageRoot, { recursive: true, force: true }));
await mkdir(join(packageRoot, 'packages/eval'), { recursive: true });
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, packageRoot);

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, packageRoot);
});

test('preserves an explicit bundle path', () => {
const environment = { MAKA_EVAL_MAKA_BUNDLE_PATH: '/explicit/bundle' };

configureInstalledEvalBundle(environment, '/installed/package');

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, '/explicit/bundle');
});

test('does not change source-checkout behavior without a packaged Eval mirror', () => {
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, '/missing/package');

assert.equal(Object.hasOwn(environment, 'MAKA_EVAL_MAKA_BUNDLE_PATH'), false);
});
});
2 changes: 2 additions & 0 deletions packages/cli/src/cli-core.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -180,6 +180,8 @@ export async function runMakaCli(
return runMakaActivationCli(command.args);
}
case 'eval': {
const { configureInstalledEvalBundle } = await import('./eval-bundle-path.js');
configureInstalledEvalBundle();
const { runMakaEvalCli } = await import('@maka/eval');
return runMakaEvalCli(command.args);
}
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/eval-bundle-path.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
import { statSync } from 'node:fs';
import { resolve } from 'node:path';

const MAKA_EVAL_BUNDLE_ENV = 'MAKA_EVAL_MAKA_BUNDLE_PATH';

export function configureInstalledEvalBundle(
environment: NodeJS.ProcessEnv = process.env,
packageRoot = resolve(import.meta.dirname, '..'),
): void {
if (Object.hasOwn(environment, MAKA_EVAL_BUNDLE_ENV)) return;
try {
if (!statSync(resolve(packageRoot, 'packages/eval')).isDirectory()) return;
} catch {
return;
}
environment[MAKA_EVAL_BUNDLE_ENV] = packageRoot;
}
49 changes: 38 additions & 11 deletions scripts/generate-third-party-notices.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,33 @@ import { join, resolve } from 'node:path';
import { npmSpawnOptions } from './npm-spawn.mjs';

const repoRoot = resolve(import.meta.dirname, '..');
const outputPath = join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt');
const checkOnly = process.argv.includes('--check');
const targetName = (() => {
const index = process.argv.indexOf('--target');
if (index < 0) return 'desktop';
const value = process.argv[index + 1];
if (!value) throw new Error('--target requires desktop or cli');
return value;
})();
const TARGETS = {
desktop: {
workspaceName: '@maka/desktop',
title: 'Maka Desktop — Production npm Third-Party Notices',
underline: '====================================================',
outputPath: join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt'),
validateAssets: true,
},
cli: {
workspaceName: 'maka-agent',
title: 'Maka CLI — Production npm Third-Party Notices',
underline: '=============================================',
outputPath: join(repoRoot, 'packages/cli/THIRD_PARTY_NOTICES.txt'),
validateAssets: false,
},
};
const target = TARGETS[targetName];
if (!target) throw new Error(`Unsupported notice target: ${targetName}`);
const { outputPath } = target;
const assetNoticePath = join(repoRoot, 'apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt');
const REQUIRED_ASSET_NOTICE_MARKERS = [
'## Simple Icons brand marks',
Expand DownExpand Up@@ -78,6 +103,8 @@ const EMBEDDED_COMPONENT_LICENSES = new Map([
],
]);
const MIT_COPYRIGHT_OVERRIDES = new Map([
// The published tarball omits the monorepo-root LICENSE.
['@earendil-works/pi-tui@0.83.0', 'Copyright (c) 2025 Mario Zechner'],
// The published tarball omits the repository LICENSE; sibling @astryxdesign
// packages ship it verbatim with this notice.
['@astryxdesign/core@0.1.9', 'Copyright (c) 2026 Meta Platforms, Inc.'],
Expand DownExpand Up@@ -137,20 +164,20 @@ function normalizeText(text) {
.trim();
}

function collectDesktopClosure() {
function collectWorkspaceClosure(workspaceName) {
const tree = JSON.parse(
execFileSync(
'npm',
['ls', '--workspace', '@maka/desktop', '--omit=dev', '--all', '--json'],
['ls', '--workspace', workspaceName, '--omit=dev', '--all', '--json'],
npmSpawnOptions({
cwd: repoRoot,
encoding: 'utf8',
maxBuffer: 16 * 1024 * 1024,
}),
),
);
const desktop = tree.dependencies?.['@maka/desktop'];
if (!desktop) throw new Error('npm ls did not return the @maka/desktop workspace');
const workspace = tree.dependencies?.[workspaceName];
if (!workspace) throw new Error(`npm ls did not return the ${workspaceName} workspace`);

const packages = new Map();
const visit = (dependencies) => {
Expand All@@ -165,7 +192,7 @@ function collectDesktopClosure() {
visit(dependency.dependencies);
}
};
visit(desktop.dependencies);
visit(workspace.dependencies);
return [...packages.values()].sort(
(left, right) =>
left.name.localeCompare(right.name) || left.version.localeCompare(right.version),
Expand DownExpand Up@@ -236,7 +263,7 @@ function overrideLicenseText(packageKey, selectedLicense) {
function renderNotice() {
const lockIndex = buildLockIndex();
const sections = [];
const dependencies = collectDesktopClosure();
const dependencies = collectWorkspaceClosure(target.workspaceName);
for (const dependency of dependencies) {
const packageKey = `${dependency.name}@${dependency.version}`;
const candidates = lockIndex.get(packageKey);
Expand DownExpand Up@@ -303,11 +330,11 @@ function renderNotice() {
}
}

return `Maka Desktop — Production npm Third-Party Notices
====================================================
return `${target.title}
${target.underline}

Generated by scripts/generate-third-party-notices.mjs from the exact
@maka/desktop production dependency closure and package-lock.json.
${target.workspaceName} production dependency closure and package-lock.json.
Do not edit this file by hand.

Policy: every package must resolve to an ASF-compatible SPDX license. Compound
Expand DownExpand Up@@ -396,7 +423,7 @@ function describeNoticeDrift(committed, generated) {
return lines.join('\n');
}

validateAssetNotices();
if (target.validateAssets) validateAssetNotices();
const generated = renderNotice();
if (checkOnly) {
if (!existsSync(outputPath)) {
Expand Down
38 changes: 38 additions & 0 deletions scripts/release-cli-file-policy.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
const DEVELOPMENT_DIRECTORIES = new Set([
'.nyc_output',
'__fixtures__',
'__tests__',
'coverage',
'fixture',
'fixtures',
'test',
'tests',
]);

export function isThirdPartyDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
/\.(?:spec|test)\.(?:cjs|js|mjs)$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.(?:cjs|js|mjs)\.map$/.test(file) ||
/\.(?:cts|mts|ts|tsx)$/.test(file) ||
file.endsWith('.tsbuildinfo')
);
}

export function isMakaDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => segment === 'src')) return true;
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
file === 'dev-cli.js' ||
/\.(?:spec|test)\.js$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.js\.map$/.test(file)
);
}
41 changes: 41 additions & 0 deletions scripts/release-cli-file-policy.test.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
isMakaDevelopmentArtifact,
isThirdPartyDevelopmentArtifact,
} from './release-cli-file-policy.mjs';

describe('CLI release file policy', () => {
test('rejects third-party development artifacts on every platform', () => {
for (const path of [
'coverage/lcov.info',
'test/fixture/input.json',
'lib/parser.test.js',
'dist/index.d.ts',
'dist/index.js.map',
String.raw`fixtures\windows.json`,
'src/index.ts',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), true, path);
}
});

test('preserves third-party runtime source and native assets', () => {
for (const path of [
'src/index.js',
'dist/index.js',
'prebuilds/darwin-arm64/pty.node',
'prebuilds/win32-x64/conpty/OpenConsole.exe',
'LICENSE',
'package.json',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), false, path);
}
});

test('keeps the stricter Maka-owned package boundary', () => {
assert.equal(isMakaDevelopmentArtifact('src/index.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/__tests__/fixture.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/index.js'), false);
});
});
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,3 +34,4 @@ apps/desktop/bundled-git.json
apps/desktop/resources/tools/
apps/desktop/release/
apps/desktop/release-sources/
packages/cli/release/
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,9 +40,13 @@
"check:stale": "node scripts/check-stale-dist.mjs",
"generate:third-party-notices": "node scripts/generate-third-party-notices.mjs",
"check:third-party-notices": "node scripts/generate-third-party-notices.mjs --check",
"generate:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli",
"check:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli --check",
"release:cli:pack": "node scripts/release-cli-package.mjs",
"release:cli:smoke": "node scripts/smoke-release-cli-package.mjs",
"generate:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs",
"check:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs --check",
"check:release": "npm run check:stale && npm run check:third-party-notices",
"check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && node --test scripts/release-cli-file-policy.test.mjs",
"package:macos-arm64": "node scripts/package-macos-arm64.mjs",
"verify:macos-arm64": "node scripts/verify-macos-arm64-dmg.mjs",
"package:windows-x64": "node scripts/package-windows-x64.mjs",
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
# Maka CLI

Maka is a local-first agent workspace for terminal and desktop workflows. This package installs
the interactive terminal UI and non-interactive CLI.

> **Beta:** the CLI is under active development. Commands and local data formats may change before
> the stable release.

## Install

```bash
npm install --global maka-agent@next
maka
```

`maka-agent` is an alias for `maka`. Node.js 22.19.0 or newer is required.

Use `maka --help` for the supported command surface. `maka eval` additionally requires the
executor environment declared by the selected experiment, such as Docker and Harbor or Pier; the
npm package includes Maka's Eval runtime but does not install those external systems.

## Links

- [Repository](https://github.com/maka-agent/maka-agent)
- [Issues](https://github.com/maka-agent/maka-agent/issues)
- [License](https://github.com/maka-agent/maka-agent/blob/main/LICENSE)
9,494 changes: 9,494 additions & 0 deletions packages/cli/THIRD_PARTY_NOTICES.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "maka-agent",
"version": "0.1.0",
"version": "0.1.0-beta.1",
"license": "Apache-2.0",
"private": true,
"type": "module",
Expand Down
35 changes: 35 additions & 0 deletions packages/cli/src/__tests__/eval-bundle-path.test.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
import assert from 'node:assert/strict';
import { mkdtemp, mkdir, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { describe, test } from 'node:test';
import { configureInstalledEvalBundle } from '../eval-bundle-path.js';

describe('installed Eval bundle', () => {
test('points Eval containers at the installed package root', async (t) => {
const packageRoot = await mkdtemp(join(tmpdir(), 'maka-cli-eval-bundle-'));
t.after(() => rm(packageRoot, { recursive: true, force: true }));
await mkdir(join(packageRoot, 'packages/eval'), { recursive: true });
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, packageRoot);

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, packageRoot);
});

test('preserves an explicit bundle path', () => {
const environment = { MAKA_EVAL_MAKA_BUNDLE_PATH: '/explicit/bundle' };

configureInstalledEvalBundle(environment, '/installed/package');

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, '/explicit/bundle');
});

test('does not change source-checkout behavior without a packaged Eval mirror', () => {
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, '/missing/package');

assert.equal(Object.hasOwn(environment, 'MAKA_EVAL_MAKA_BUNDLE_PATH'), false);
});
});
2 changes: 2 additions & 0 deletions packages/cli/src/cli-core.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -180,6 +180,8 @@ export async function runMakaCli(
return runMakaActivationCli(command.args);
}
case 'eval': {
const { configureInstalledEvalBundle } = await import('./eval-bundle-path.js');
configureInstalledEvalBundle();
const { runMakaEvalCli } = await import('@maka/eval');
return runMakaEvalCli(command.args);
}
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/eval-bundle-path.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
import { statSync } from 'node:fs';
import { resolve } from 'node:path';

const MAKA_EVAL_BUNDLE_ENV = 'MAKA_EVAL_MAKA_BUNDLE_PATH';

export function configureInstalledEvalBundle(
environment: NodeJS.ProcessEnv = process.env,
packageRoot = resolve(import.meta.dirname, '..'),
): void {
if (Object.hasOwn(environment, MAKA_EVAL_BUNDLE_ENV)) return;
try {
if (!statSync(resolve(packageRoot, 'packages/eval')).isDirectory()) return;
} catch {
return;
}
environment[MAKA_EVAL_BUNDLE_ENV] = packageRoot;
}
49 changes: 38 additions & 11 deletions scripts/generate-third-party-notices.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,33 @@ import { join, resolve } from 'node:path';
import { npmSpawnOptions } from './npm-spawn.mjs';

const repoRoot = resolve(import.meta.dirname, '..');
const outputPath = join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt');
const checkOnly = process.argv.includes('--check');
const targetName = (() => {
const index = process.argv.indexOf('--target');
if (index < 0) return 'desktop';
const value = process.argv[index + 1];
if (!value) throw new Error('--target requires desktop or cli');
return value;
})();
const TARGETS = {
desktop: {
workspaceName: '@maka/desktop',
title: 'Maka Desktop — Production npm Third-Party Notices',
underline: '====================================================',
outputPath: join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt'),
validateAssets: true,
},
cli: {
workspaceName: 'maka-agent',
title: 'Maka CLI — Production npm Third-Party Notices',
underline: '=============================================',
outputPath: join(repoRoot, 'packages/cli/THIRD_PARTY_NOTICES.txt'),
validateAssets: false,
},
};
const target = TARGETS[targetName];
if (!target) throw new Error(`Unsupported notice target: ${targetName}`);
const { outputPath } = target;
const assetNoticePath = join(repoRoot, 'apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt');
const REQUIRED_ASSET_NOTICE_MARKERS = [
'## Simple Icons brand marks',
Expand DownExpand Up@@ -78,6 +103,8 @@ const EMBEDDED_COMPONENT_LICENSES = new Map([
],
]);
const MIT_COPYRIGHT_OVERRIDES = new Map([
// The published tarball omits the monorepo-root LICENSE.
['@earendil-works/pi-tui@0.83.0', 'Copyright (c) 2025 Mario Zechner'],
// The published tarball omits the repository LICENSE; sibling @astryxdesign
// packages ship it verbatim with this notice.
['@astryxdesign/core@0.1.9', 'Copyright (c) 2026 Meta Platforms, Inc.'],
Expand DownExpand Up@@ -137,20 +164,20 @@ function normalizeText(text) {
.trim();
}

function collectDesktopClosure() {
function collectWorkspaceClosure(workspaceName) {
const tree = JSON.parse(
execFileSync(
'npm',
['ls', '--workspace', '@maka/desktop', '--omit=dev', '--all', '--json'],
['ls', '--workspace', workspaceName, '--omit=dev', '--all', '--json'],
npmSpawnOptions({
cwd: repoRoot,
encoding: 'utf8',
maxBuffer: 16 * 1024 * 1024,
}),
),
);
const desktop = tree.dependencies?.['@maka/desktop'];
if (!desktop) throw new Error('npm ls did not return the @maka/desktop workspace');
const workspace = tree.dependencies?.[workspaceName];
if (!workspace) throw new Error(`npm ls did not return the ${workspaceName} workspace`);

const packages = new Map();
const visit = (dependencies) => {
Expand All@@ -165,7 +192,7 @@ function collectDesktopClosure() {
visit(dependency.dependencies);
}
};
visit(desktop.dependencies);
visit(workspace.dependencies);
return [...packages.values()].sort(
(left, right) =>
left.name.localeCompare(right.name) || left.version.localeCompare(right.version),
Expand DownExpand Up@@ -236,7 +263,7 @@ function overrideLicenseText(packageKey, selectedLicense) {
function renderNotice() {
const lockIndex = buildLockIndex();
const sections = [];
const dependencies = collectDesktopClosure();
const dependencies = collectWorkspaceClosure(target.workspaceName);
for (const dependency of dependencies) {
const packageKey = `${dependency.name}@${dependency.version}`;
const candidates = lockIndex.get(packageKey);
Expand DownExpand Up@@ -303,11 +330,11 @@ function renderNotice() {
}
}

return `Maka Desktop — Production npm Third-Party Notices
====================================================
return `${target.title}
${target.underline}

Generated by scripts/generate-third-party-notices.mjs from the exact
@maka/desktop production dependency closure and package-lock.json.
${target.workspaceName} production dependency closure and package-lock.json.
Do not edit this file by hand.

Policy: every package must resolve to an ASF-compatible SPDX license. Compound
Expand DownExpand Up@@ -396,7 +423,7 @@ function describeNoticeDrift(committed, generated) {
return lines.join('\n');
}

validateAssetNotices();
if (target.validateAssets) validateAssetNotices();
const generated = renderNotice();
if (checkOnly) {
if (!existsSync(outputPath)) {
Expand Down
38 changes: 38 additions & 0 deletions scripts/release-cli-file-policy.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
const DEVELOPMENT_DIRECTORIES = new Set([
'.nyc_output',
'__fixtures__',
'__tests__',
'coverage',
'fixture',
'fixtures',
'test',
'tests',
]);

export function isThirdPartyDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
/\.(?:spec|test)\.(?:cjs|js|mjs)$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.(?:cjs|js|mjs)\.map$/.test(file) ||
/\.(?:cts|mts|ts|tsx)$/.test(file) ||
file.endsWith('.tsbuildinfo')
);
}

export function isMakaDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => segment === 'src')) return true;
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
file === 'dev-cli.js' ||
/\.(?:spec|test)\.js$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.js\.map$/.test(file)
);
}
41 changes: 41 additions & 0 deletions scripts/release-cli-file-policy.test.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
isMakaDevelopmentArtifact,
isThirdPartyDevelopmentArtifact,
} from './release-cli-file-policy.mjs';

describe('CLI release file policy', () => {
test('rejects third-party development artifacts on every platform', () => {
for (const path of [
'coverage/lcov.info',
'test/fixture/input.json',
'lib/parser.test.js',
'dist/index.d.ts',
'dist/index.js.map',
String.raw`fixtures\windows.json`,
'src/index.ts',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), true, path);
}
});

test('preserves third-party runtime source and native assets', () => {
for (const path of [
'src/index.js',
'dist/index.js',
'prebuilds/darwin-arm64/pty.node',
'prebuilds/win32-x64/conpty/OpenConsole.exe',
'LICENSE',
'package.json',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), false, path);
}
});

test('keeps the stricter Maka-owned package boundary', () => {
assert.equal(isMakaDevelopmentArtifact('src/index.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/__tests__/fixture.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/index.js'), false);
});
});
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,3 +34,4 @@ apps/desktop/bundled-git.json
apps/desktop/resources/tools/
apps/desktop/release/
apps/desktop/release-sources/
packages/cli/release/
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,9 +40,13 @@
"check:stale": "node scripts/check-stale-dist.mjs",
"generate:third-party-notices": "node scripts/generate-third-party-notices.mjs",
"check:third-party-notices": "node scripts/generate-third-party-notices.mjs --check",
"generate:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli",
"check:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli --check",
"release:cli:pack": "node scripts/release-cli-package.mjs",
"release:cli:smoke": "node scripts/smoke-release-cli-package.mjs",
"generate:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs",
"check:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs --check",
"check:release": "npm run check:stale && npm run check:third-party-notices",
"check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && node --test scripts/release-cli-file-policy.test.mjs",
"package:macos-arm64": "node scripts/package-macos-arm64.mjs",
"verify:macos-arm64": "node scripts/verify-macos-arm64-dmg.mjs",
"package:windows-x64": "node scripts/package-windows-x64.mjs",
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
# Maka CLI

Maka is a local-first agent workspace for terminal and desktop workflows. This package installs
the interactive terminal UI and non-interactive CLI.

> **Beta:** the CLI is under active development. Commands and local data formats may change before
> the stable release.

## Install

```bash
npm install --global maka-agent@next
maka
```

`maka-agent` is an alias for `maka`. Node.js 22.19.0 or newer is required.

Use `maka --help` for the supported command surface. `maka eval` additionally requires the
executor environment declared by the selected experiment, such as Docker and Harbor or Pier; the
npm package includes Maka's Eval runtime but does not install those external systems.

## Links

- [Repository](https://github.com/maka-agent/maka-agent)
- [Issues](https://github.com/maka-agent/maka-agent/issues)
- [License](https://github.com/maka-agent/maka-agent/blob/main/LICENSE)
9,494 changes: 9,494 additions & 0 deletions packages/cli/THIRD_PARTY_NOTICES.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "maka-agent",
"version": "0.1.0",
"version": "0.1.0-beta.1",
"license": "Apache-2.0",
"private": true,
"type": "module",
Expand Down
35 changes: 35 additions & 0 deletions packages/cli/src/__tests__/eval-bundle-path.test.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
import assert from 'node:assert/strict';
import { mkdtemp, mkdir, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { describe, test } from 'node:test';
import { configureInstalledEvalBundle } from '../eval-bundle-path.js';

describe('installed Eval bundle', () => {
test('points Eval containers at the installed package root', async (t) => {
const packageRoot = await mkdtemp(join(tmpdir(), 'maka-cli-eval-bundle-'));
t.after(() => rm(packageRoot, { recursive: true, force: true }));
await mkdir(join(packageRoot, 'packages/eval'), { recursive: true });
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, packageRoot);

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, packageRoot);
});

test('preserves an explicit bundle path', () => {
const environment = { MAKA_EVAL_MAKA_BUNDLE_PATH: '/explicit/bundle' };

configureInstalledEvalBundle(environment, '/installed/package');

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, '/explicit/bundle');
});

test('does not change source-checkout behavior without a packaged Eval mirror', () => {
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, '/missing/package');

assert.equal(Object.hasOwn(environment, 'MAKA_EVAL_MAKA_BUNDLE_PATH'), false);
});
});
2 changes: 2 additions & 0 deletions packages/cli/src/cli-core.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -180,6 +180,8 @@ export async function runMakaCli(
return runMakaActivationCli(command.args);
}
case 'eval': {
const { configureInstalledEvalBundle } = await import('./eval-bundle-path.js');
configureInstalledEvalBundle();
const { runMakaEvalCli } = await import('@maka/eval');
return runMakaEvalCli(command.args);
}
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/eval-bundle-path.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
import { statSync } from 'node:fs';
import { resolve } from 'node:path';

const MAKA_EVAL_BUNDLE_ENV = 'MAKA_EVAL_MAKA_BUNDLE_PATH';

export function configureInstalledEvalBundle(
environment: NodeJS.ProcessEnv = process.env,
packageRoot = resolve(import.meta.dirname, '..'),
): void {
if (Object.hasOwn(environment, MAKA_EVAL_BUNDLE_ENV)) return;
try {
if (!statSync(resolve(packageRoot, 'packages/eval')).isDirectory()) return;
} catch {
return;
}
environment[MAKA_EVAL_BUNDLE_ENV] = packageRoot;
}
49 changes: 38 additions & 11 deletions scripts/generate-third-party-notices.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,33 @@ import { join, resolve } from 'node:path';
import { npmSpawnOptions } from './npm-spawn.mjs';

const repoRoot = resolve(import.meta.dirname, '..');
const outputPath = join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt');
const checkOnly = process.argv.includes('--check');
const targetName = (() => {
const index = process.argv.indexOf('--target');
if (index < 0) return 'desktop';
const value = process.argv[index + 1];
if (!value) throw new Error('--target requires desktop or cli');
return value;
})();
const TARGETS = {
desktop: {
workspaceName: '@maka/desktop',
title: 'Maka Desktop — Production npm Third-Party Notices',
underline: '====================================================',
outputPath: join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt'),
validateAssets: true,
},
cli: {
workspaceName: 'maka-agent',
title: 'Maka CLI — Production npm Third-Party Notices',
underline: '=============================================',
outputPath: join(repoRoot, 'packages/cli/THIRD_PARTY_NOTICES.txt'),
validateAssets: false,
},
};
const target = TARGETS[targetName];
if (!target) throw new Error(`Unsupported notice target: ${targetName}`);
const { outputPath } = target;
const assetNoticePath = join(repoRoot, 'apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt');
const REQUIRED_ASSET_NOTICE_MARKERS = [
'## Simple Icons brand marks',
Expand DownExpand Up@@ -78,6 +103,8 @@ const EMBEDDED_COMPONENT_LICENSES = new Map([
],
]);
const MIT_COPYRIGHT_OVERRIDES = new Map([
// The published tarball omits the monorepo-root LICENSE.
['@earendil-works/pi-tui@0.83.0', 'Copyright (c) 2025 Mario Zechner'],
// The published tarball omits the repository LICENSE; sibling @astryxdesign
// packages ship it verbatim with this notice.
['@astryxdesign/core@0.1.9', 'Copyright (c) 2026 Meta Platforms, Inc.'],
Expand DownExpand Up@@ -137,20 +164,20 @@ function normalizeText(text) {
.trim();
}

function collectDesktopClosure() {
function collectWorkspaceClosure(workspaceName) {
const tree = JSON.parse(
execFileSync(
'npm',
['ls', '--workspace', '@maka/desktop', '--omit=dev', '--all', '--json'],
['ls', '--workspace', workspaceName, '--omit=dev', '--all', '--json'],
npmSpawnOptions({
cwd: repoRoot,
encoding: 'utf8',
maxBuffer: 16 * 1024 * 1024,
}),
),
);
const desktop = tree.dependencies?.['@maka/desktop'];
if (!desktop) throw new Error('npm ls did not return the @maka/desktop workspace');
const workspace = tree.dependencies?.[workspaceName];
if (!workspace) throw new Error(`npm ls did not return the ${workspaceName} workspace`);

const packages = new Map();
const visit = (dependencies) => {
Expand All@@ -165,7 +192,7 @@ function collectDesktopClosure() {
visit(dependency.dependencies);
}
};
visit(desktop.dependencies);
visit(workspace.dependencies);
return [...packages.values()].sort(
(left, right) =>
left.name.localeCompare(right.name) || left.version.localeCompare(right.version),
Expand DownExpand Up@@ -236,7 +263,7 @@ function overrideLicenseText(packageKey, selectedLicense) {
function renderNotice() {
const lockIndex = buildLockIndex();
const sections = [];
const dependencies = collectDesktopClosure();
const dependencies = collectWorkspaceClosure(target.workspaceName);
for (const dependency of dependencies) {
const packageKey = `${dependency.name}@${dependency.version}`;
const candidates = lockIndex.get(packageKey);
Expand DownExpand Up@@ -303,11 +330,11 @@ function renderNotice() {
}
}

return `Maka Desktop — Production npm Third-Party Notices
====================================================
return `${target.title}
${target.underline}

Generated by scripts/generate-third-party-notices.mjs from the exact
@maka/desktop production dependency closure and package-lock.json.
${target.workspaceName} production dependency closure and package-lock.json.
Do not edit this file by hand.

Policy: every package must resolve to an ASF-compatible SPDX license. Compound
Expand DownExpand Up@@ -396,7 +423,7 @@ function describeNoticeDrift(committed, generated) {
return lines.join('\n');
}

validateAssetNotices();
if (target.validateAssets) validateAssetNotices();
const generated = renderNotice();
if (checkOnly) {
if (!existsSync(outputPath)) {
Expand Down
38 changes: 38 additions & 0 deletions scripts/release-cli-file-policy.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
const DEVELOPMENT_DIRECTORIES = new Set([
'.nyc_output',
'__fixtures__',
'__tests__',
'coverage',
'fixture',
'fixtures',
'test',
'tests',
]);

export function isThirdPartyDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
/\.(?:spec|test)\.(?:cjs|js|mjs)$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.(?:cjs|js|mjs)\.map$/.test(file) ||
/\.(?:cts|mts|ts|tsx)$/.test(file) ||
file.endsWith('.tsbuildinfo')
);
}

export function isMakaDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => segment === 'src')) return true;
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
file === 'dev-cli.js' ||
/\.(?:spec|test)\.js$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.js\.map$/.test(file)
);
}
41 changes: 41 additions & 0 deletions scripts/release-cli-file-policy.test.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
isMakaDevelopmentArtifact,
isThirdPartyDevelopmentArtifact,
} from './release-cli-file-policy.mjs';

describe('CLI release file policy', () => {
test('rejects third-party development artifacts on every platform', () => {
for (const path of [
'coverage/lcov.info',
'test/fixture/input.json',
'lib/parser.test.js',
'dist/index.d.ts',
'dist/index.js.map',
String.raw`fixtures\windows.json`,
'src/index.ts',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), true, path);
}
});

test('preserves third-party runtime source and native assets', () => {
for (const path of [
'src/index.js',
'dist/index.js',
'prebuilds/darwin-arm64/pty.node',
'prebuilds/win32-x64/conpty/OpenConsole.exe',
'LICENSE',
'package.json',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), false, path);
}
});

test('keeps the stricter Maka-owned package boundary', () => {
assert.equal(isMakaDevelopmentArtifact('src/index.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/__tests__/fixture.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/index.js'), false);
});
});
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,3 +34,4 @@ apps/desktop/bundled-git.json
apps/desktop/resources/tools/
apps/desktop/release/
apps/desktop/release-sources/
packages/cli/release/
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,9 +40,13 @@
"check:stale": "node scripts/check-stale-dist.mjs",
"generate:third-party-notices": "node scripts/generate-third-party-notices.mjs",
"check:third-party-notices": "node scripts/generate-third-party-notices.mjs --check",
"generate:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli",
"check:cli-third-party-notices": "node scripts/generate-third-party-notices.mjs --target cli --check",
"release:cli:pack": "node scripts/release-cli-package.mjs",
"release:cli:smoke": "node scripts/smoke-release-cli-package.mjs",
"generate:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs",
"check:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs --check",
"check:release": "npm run check:stale && npm run check:third-party-notices",
"check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && node --test scripts/release-cli-file-policy.test.mjs",
"package:macos-arm64": "node scripts/package-macos-arm64.mjs",
"verify:macos-arm64": "node scripts/verify-macos-arm64-dmg.mjs",
"package:windows-x64": "node scripts/package-windows-x64.mjs",
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
# Maka CLI

Maka is a local-first agent workspace for terminal and desktop workflows. This package installs
the interactive terminal UI and non-interactive CLI.

> **Beta:** the CLI is under active development. Commands and local data formats may change before
> the stable release.

## Install

```bash
npm install --global maka-agent@next
maka
```

`maka-agent` is an alias for `maka`. Node.js 22.19.0 or newer is required.

Use `maka --help` for the supported command surface. `maka eval` additionally requires the
executor environment declared by the selected experiment, such as Docker and Harbor or Pier; the
npm package includes Maka's Eval runtime but does not install those external systems.

## Links

- [Repository](https://github.com/maka-agent/maka-agent)
- [Issues](https://github.com/maka-agent/maka-agent/issues)
- [License](https://github.com/maka-agent/maka-agent/blob/main/LICENSE)
9,494 changes: 9,494 additions & 0 deletions packages/cli/THIRD_PARTY_NOTICES.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name": "maka-agent",
"version": "0.1.0",
"version": "0.1.0-beta.1",
"license": "Apache-2.0",
"private": true,
"type": "module",
Expand Down
35 changes: 35 additions & 0 deletions packages/cli/src/__tests__/eval-bundle-path.test.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
import assert from 'node:assert/strict';
import { mkdtemp, mkdir, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { describe, test } from 'node:test';
import { configureInstalledEvalBundle } from '../eval-bundle-path.js';

describe('installed Eval bundle', () => {
test('points Eval containers at the installed package root', async (t) => {
const packageRoot = await mkdtemp(join(tmpdir(), 'maka-cli-eval-bundle-'));
t.after(() => rm(packageRoot, { recursive: true, force: true }));
await mkdir(join(packageRoot, 'packages/eval'), { recursive: true });
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, packageRoot);

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, packageRoot);
});

test('preserves an explicit bundle path', () => {
const environment = { MAKA_EVAL_MAKA_BUNDLE_PATH: '/explicit/bundle' };

configureInstalledEvalBundle(environment, '/installed/package');

assert.equal(environment.MAKA_EVAL_MAKA_BUNDLE_PATH, '/explicit/bundle');
});

test('does not change source-checkout behavior without a packaged Eval mirror', () => {
const environment: NodeJS.ProcessEnv = {};

configureInstalledEvalBundle(environment, '/missing/package');

assert.equal(Object.hasOwn(environment, 'MAKA_EVAL_MAKA_BUNDLE_PATH'), false);
});
});
2 changes: 2 additions & 0 deletions packages/cli/src/cli-core.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -180,6 +180,8 @@ export async function runMakaCli(
return runMakaActivationCli(command.args);
}
case 'eval': {
const { configureInstalledEvalBundle } = await import('./eval-bundle-path.js');
configureInstalledEvalBundle();
const { runMakaEvalCli } = await import('@maka/eval');
return runMakaEvalCli(command.args);
}
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/eval-bundle-path.ts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
import { statSync } from 'node:fs';
import { resolve } from 'node:path';

const MAKA_EVAL_BUNDLE_ENV = 'MAKA_EVAL_MAKA_BUNDLE_PATH';

export function configureInstalledEvalBundle(
environment: NodeJS.ProcessEnv = process.env,
packageRoot = resolve(import.meta.dirname, '..'),
): void {
if (Object.hasOwn(environment, MAKA_EVAL_BUNDLE_ENV)) return;
try {
if (!statSync(resolve(packageRoot, 'packages/eval')).isDirectory()) return;
} catch {
return;
}
environment[MAKA_EVAL_BUNDLE_ENV] = packageRoot;
}
49 changes: 38 additions & 11 deletions scripts/generate-third-party-notices.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,33 @@ import { join, resolve } from 'node:path';
import { npmSpawnOptions } from './npm-spawn.mjs';

const repoRoot = resolve(import.meta.dirname, '..');
const outputPath = join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt');
const checkOnly = process.argv.includes('--check');
const targetName = (() => {
const index = process.argv.indexOf('--target');
if (index < 0) return 'desktop';
const value = process.argv[index + 1];
if (!value) throw new Error('--target requires desktop or cli');
return value;
})();
const TARGETS = {
desktop: {
workspaceName: '@maka/desktop',
title: 'Maka Desktop — Production npm Third-Party Notices',
underline: '====================================================',
outputPath: join(repoRoot, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt'),
validateAssets: true,
},
cli: {
workspaceName: 'maka-agent',
title: 'Maka CLI — Production npm Third-Party Notices',
underline: '=============================================',
outputPath: join(repoRoot, 'packages/cli/THIRD_PARTY_NOTICES.txt'),
validateAssets: false,
},
};
const target = TARGETS[targetName];
if (!target) throw new Error(`Unsupported notice target: ${targetName}`);
const { outputPath } = target;
const assetNoticePath = join(repoRoot, 'apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt');
const REQUIRED_ASSET_NOTICE_MARKERS = [
'## Simple Icons brand marks',
Expand DownExpand Up@@ -78,6 +103,8 @@ const EMBEDDED_COMPONENT_LICENSES = new Map([
],
]);
const MIT_COPYRIGHT_OVERRIDES = new Map([
// The published tarball omits the monorepo-root LICENSE.
['@earendil-works/pi-tui@0.83.0', 'Copyright (c) 2025 Mario Zechner'],
// The published tarball omits the repository LICENSE; sibling @astryxdesign
// packages ship it verbatim with this notice.
['@astryxdesign/core@0.1.9', 'Copyright (c) 2026 Meta Platforms, Inc.'],
Expand DownExpand Up@@ -137,20 +164,20 @@ function normalizeText(text) {
.trim();
}

function collectDesktopClosure() {
function collectWorkspaceClosure(workspaceName) {
const tree = JSON.parse(
execFileSync(
'npm',
['ls', '--workspace', '@maka/desktop', '--omit=dev', '--all', '--json'],
['ls', '--workspace', workspaceName, '--omit=dev', '--all', '--json'],
npmSpawnOptions({
cwd: repoRoot,
encoding: 'utf8',
maxBuffer: 16 * 1024 * 1024,
}),
),
);
const desktop = tree.dependencies?.['@maka/desktop'];
if (!desktop) throw new Error('npm ls did not return the @maka/desktop workspace');
const workspace = tree.dependencies?.[workspaceName];
if (!workspace) throw new Error(`npm ls did not return the ${workspaceName} workspace`);

const packages = new Map();
const visit = (dependencies) => {
Expand All@@ -165,7 +192,7 @@ function collectDesktopClosure() {
visit(dependency.dependencies);
}
};
visit(desktop.dependencies);
visit(workspace.dependencies);
return [...packages.values()].sort(
(left, right) =>
left.name.localeCompare(right.name) || left.version.localeCompare(right.version),
Expand DownExpand Up@@ -236,7 +263,7 @@ function overrideLicenseText(packageKey, selectedLicense) {
function renderNotice() {
const lockIndex = buildLockIndex();
const sections = [];
const dependencies = collectDesktopClosure();
const dependencies = collectWorkspaceClosure(target.workspaceName);
for (const dependency of dependencies) {
const packageKey = `${dependency.name}@${dependency.version}`;
const candidates = lockIndex.get(packageKey);
Expand DownExpand Up@@ -303,11 +330,11 @@ function renderNotice() {
}
}

return `Maka Desktop — Production npm Third-Party Notices
====================================================
return `${target.title}
${target.underline}

Generated by scripts/generate-third-party-notices.mjs from the exact
@maka/desktop production dependency closure and package-lock.json.
${target.workspaceName} production dependency closure and package-lock.json.
Do not edit this file by hand.

Policy: every package must resolve to an ASF-compatible SPDX license. Compound
Expand DownExpand Up@@ -396,7 +423,7 @@ function describeNoticeDrift(committed, generated) {
return lines.join('\n');
}

validateAssetNotices();
if (target.validateAssets) validateAssetNotices();
const generated = renderNotice();
if (checkOnly) {
if (!existsSync(outputPath)) {
Expand Down
38 changes: 38 additions & 0 deletions scripts/release-cli-file-policy.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
const DEVELOPMENT_DIRECTORIES = new Set([
'.nyc_output',
'__fixtures__',
'__tests__',
'coverage',
'fixture',
'fixtures',
'test',
'tests',
]);

export function isThirdPartyDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
/\.(?:spec|test)\.(?:cjs|js|mjs)$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.(?:cjs|js|mjs)\.map$/.test(file) ||
/\.(?:cts|mts|ts|tsx)$/.test(file) ||
file.endsWith('.tsbuildinfo')
);
}

export function isMakaDevelopmentArtifact(relativePath) {
const segments = relativePath.split(/[\\/]/).filter(Boolean);
if (segments.some((segment) => segment === 'src')) return true;
if (segments.some((segment) => DEVELOPMENT_DIRECTORIES.has(segment))) return true;

const file = segments.at(-1) ?? '';
return (
file === 'dev-cli.js' ||
/\.(?:spec|test)\.js$/.test(file) ||
/\.d\.ts(?:\.map)?$/.test(file) ||
/\.js\.map$/.test(file)
);
}
41 changes: 41 additions & 0 deletions scripts/release-cli-file-policy.test.mjs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
isMakaDevelopmentArtifact,
isThirdPartyDevelopmentArtifact,
} from './release-cli-file-policy.mjs';

describe('CLI release file policy', () => {
test('rejects third-party development artifacts on every platform', () => {
for (const path of [
'coverage/lcov.info',
'test/fixture/input.json',
'lib/parser.test.js',
'dist/index.d.ts',
'dist/index.js.map',
String.raw`fixtures\windows.json`,
'src/index.ts',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), true, path);
}
});

test('preserves third-party runtime source and native assets', () => {
for (const path of [
'src/index.js',
'dist/index.js',
'prebuilds/darwin-arm64/pty.node',
'prebuilds/win32-x64/conpty/OpenConsole.exe',
'LICENSE',
'package.json',
]) {
assert.equal(isThirdPartyDevelopmentArtifact(path), false, path);
}
});

test('keeps the stricter Maka-owned package boundary', () => {
assert.equal(isMakaDevelopmentArtifact('src/index.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/__tests__/fixture.js'), true);
assert.equal(isMakaDevelopmentArtifact('dist/index.js'), false);
});
});
Loading
Loading