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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
- Rename command, setting, and custom-editor IDs from `catalyst*` to `sherpa*` for the public release.
- Fix blast-radius hop counting, webview message validation, evidence refresh/state, SCM path isolation, oversized-blame handling, and export/editor regressions from review intents 1–14.
- Remove inherited Git editor integration; Atomic remains the SCM provider.
- Add Atomic push, pull, insert-view, and add-remote commands through the installed Atomic CLI.
- Route Atomic push, pull, insert-view, and remote registration through nodeatomic and the in-process native service; remove the CLI subprocess bridge. Share Rust authentication with the CLI, surface structured failure reports, and protect unsaved current-view buffers.
- Refresh the native descriptor fingerprint after integrating Atomic dev's vault-evidence replay contract, retaining strict runtime compatibility checks.
- Upgrade vulnerable production dependencies (markdown-it, mermaid, sanitize-html, katex, Puppeteer, cspell, highlight.js, Shiki) and remove unused gRPC packages; `npm audit --omit=dev` is clean.
- Load Puppeteer 25 as an ESM runtime and make webview/graph build steps cross-platform.
- Add CI for typecheck, tests, build, universal VSIX packaging, and production audit; set the public `atomicdotdev` publisher metadata and 1.0.0 version.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Open a **trusted, local filesystem** workspace in an Atomic repository, then ope
- Enter a message and choose **✓ / Atomic: Record Tracked Changes** (or accept the input box). This records the displayed tracked paths, not untracked files, using the displayed status's concurrency fence. Save or close unsaved repository documents first. Backend fence failures are surfaced, not retried automatically.
- **Atomic History & Views** lists typed **Draft / Shared** views. Expand a view to see its change hashes, then click a hash to inspect the change without switching the working copy. **Load more changes…** pages through that view's history.
- Right-click a repository in that panel for **Create View**, **Switch View**, or **Delete View**. New views derive from the displayed current view. Deletion requires confirmation and excludes the current view. Switching never bypasses Atomic's dirty-working-copy check and also refuses unsaved editor documents.
- **Atomic: Push View** and **Atomic: Pull View** choose a remote and view names. Enter a configured remote name or an `https://atomic.storage/...` project URL; the installed Atomic CLI resolves identity authentication and project binding. **Atomic: Add Remote** records a remote in the repository.
- **Atomic: Insert View Into View** inserts all changes from one view into another with Atomic's dependency closure and conflict rules. It asks for confirmation and uses `atomic insert --confirm view`.
- **Atomic: Push View** and **Atomic: Pull View** choose a remote and view names. Enter a configured remote name or an `https://atomic.storage/...` project URL; the native Atomic service resolves identity authentication and project binding. **Atomic: Add Remote** records a remote through the same native service.
- **Atomic: Insert View Into View** inserts all changes from one view into another with Atomic's dependency closure and conflict rules. It asks for confirmation and uses the native insertion API; it does not promote Draft/Shared scope. Pull and insertion may refresh the working copy when targeting the current view, so save or close unsaved repository documents first. Inactive targets do not update host files.
- Filesystem events trigger debounced refreshes; **Atomic: Refresh Version Control** retries discovery and reloads state. Errors are available in the **Atomic Version Control** output channel.

### Change detail
Expand Down Expand Up @@ -84,11 +84,11 @@ This explicitly writes/rebuilds derived database indexes from repository authori

All repository calls run in the extension host through `nodeatomic` → the separately installed Node-enabled `libatomic.dylib`, `libatomic.so`, or `libatomic.dll`. nodeatomic selects the host OS/CPU, validates release metadata/checksums and its exact generated protobuf descriptor, then loads the library in-process. It follows the active Atomic executable on PATH (including executable symlinks), or explicit `ATOMIC_RUNTIME_DIR`, `LIBATOMIC_ADDON`, or `ATOMIC_BIN` configuration. Do not set `ATOMIC_RUNTIME_DIR` together with `LIBATOMIC_ADDON`; paths must be absolute. Automatic discovery excludes empty/relative PATH entries and the current working directory. Use a trusted installation PATH, not workspace-controlled executables.

There is no daemon startup, socket, direct database access, or webview native access for repository reads and mutations. The explicit **Push View**, **Pull View**, **Insert View Into View**, and **Add Remote** commands invoke the installed Atomic CLI because remote authentication, project binding, and view-promotion semantics are owned by that CLI. They pass argument arrays (never a shell) and surface bounded stdout/stderr in **Atomic Version Control**. Missing/incompatible runtimes fail with installation/recovery guidance, not an automatic download, compiler invocation, schema repair, or fallback to another installation. Native editor diffs use read-only backend content; no automatic repository initialization, untracking, restore mutation, signing, or attestation creation is added by this panel.
There is no CLI subprocess, daemon startup, socket, direct database access, or webview native access for any repository operation, including **Push View**, **Pull View**, **Insert View Into View**, and **Add Remote**. The trusted local Rust service uses authentication shared with the CLI; private keys, JWT signing, and delegation stay in Rust, never JavaScript. Native reports, push refusals, partial pull failures, and insertion conflicts are surfaced in **Atomic Version Control**. Missing/incompatible runtimes fail with installation/recovery guidance, not an automatic download, compiler invocation, schema repair, or fallback to another installation. Native editor diffs use read-only backend content; no automatic repository initialization, untracking, restore mutation, or attestation creation is added by this panel.

## Develop and package

Build requirements: Node.js 22+/npm (for VSCE 4), Bun, and a VS Code-compatible editor. The universal nodeatomic JavaScript consumer and its generated codecs are vendored at `vendor/nodeatomic` from revision `6e50338c1d450cef8463113198d95c61e431a0b9`, so a clean checkout builds without a sibling repository. Refresh that directory from the nodeatomic producer when its descriptor or runtime loader changes. Its compiled codecs/fingerprint are bundled, so the resulting VSIX does not need the vendor directory. Atomic Sherpa never builds Rust or searches for Atomic producer sources. Building/packaging does not require a native library unless an explicit runtime override requests the native smoke.
Build requirements: Node.js 22+/npm (for VSCE 4), Bun, and a VS Code-compatible editor. The universal nodeatomic JavaScript consumer and its generated codecs are vendored at `vendor/nodeatomic`; its NOTICE records the source revision. A clean checkout builds without a sibling repository. Refresh that directory from the nodeatomic producer when its descriptor, API, or runtime loader changes. Its compiled codecs/fingerprint are bundled, so the resulting VSIX does not need the vendor directory. Atomic Sherpa never builds Rust or searches for Atomic producer sources. Building/packaging does not require a native library unless an explicit runtime override requests the native smoke.

```sh
npm ci
Expand Down
3 changes: 2 additions & 1 deletion THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ THIS SOFTWARE.

The bundled `dist/nodeatomic/index.mjs` consumer is generated from
[`atomicdotdev/nodeatomic`](https://github.com/atomicdotdev/nodeatomic), revision
`6e50338c1d450cef8463113198d95c61e431a0b9`. The vendored build under
`ac76e68d3d7facd8aefe26ef04baf3350509b115`, with generated codecs from the matching
libatomic descriptor. The vendored build under
`vendor/nodeatomic` is used only at build time and is excluded from the VSIX.

nodeatomic is licensed under MIT OR Apache-2.0. The repository MIT license is in
Expand Down
29 changes: 0 additions & 29 deletions scripts/atomicCli.test.mjs

This file was deleted.

53 changes: 53 additions & 0 deletions scripts/atomicOperationResults.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { expect, test } from 'bun:test';
import { insertResult, pullResult, pushResult } from '../src/atomic/operationResults.ts';

const pull = (overrides = {}) => ({ appliedChanges: '2', report: {
localView: 'target', changesDownloaded: '2', changesFailed: '0', filesWritten: '0',
warnings: [], localOnly: [], downloads: [], applyErrors: [], ...overrides
} });

test('a native push refusal is not reported as a completed push', () => {
const result = pushResult({ pushedChanges: '0', conflict: {
view: 'feature', description: 'remote history diverged', identityMismatch: false
} });
expect(result.error).toContain('remote history diverged');
expect(result.lines).toEqual([]);
});

test('a native pull that applied changes but failed materialization remains an error', () => {
const result = pullResult(pull({ applied: true, materializeError: 'unrecorded file would be overwritten' }));
expect(result.error).toContain('Working copy not updated: unrecorded file would be overwritten');
expect(result.lines.join('\n')).not.toContain('Pull complete:');
expect(result.lines.join('\n')).not.toContain('switch to');
});

test('native download and reconciliation failures cannot become success', () => {
for (const report of [
{ changesFailed: '1' },
{ changesFailed: '1', downloads: [{ ok: false, error: 'change checksum mismatch' }] },
{ applyErrors: ['view closure rejected'] }
]) {
const result = pullResult(pull(report));
expect(result.error).toBeDefined();
expect(result.lines.join('\n')).toContain('Pull completed with errors:');
}
});

test('a successful inactive-view pull distinguishes membership from working-copy changes', () => {
const result = pullResult(pull({ applied: true, materialized: false, localOnly: ['local-change'],
warnings: [{ text: 'remote identity endpoint unavailable' }] }));
expect(result.error).toBeUndefined();
expect(result.lines.join('\n')).toContain('Working copy unchanged; switch to “target”');
expect(result.lines.join('\n')).toContain('1 local changes are not on the remote');
expect(result.lines.join('\n')).toContain('remote identity endpoint unavailable');
});

test('insertion exposes both new and pre-existing conflicts', () => {
for (const response of [
{ hasConflicts: true, conflicts: [] },
{ hasConflicts: false, conflicts: [{ path: 'conflicted.txt' }] }
]) {
const result = insertResult({ inserted: [], resolvedTargetView: 'target', skippedCount: 0, ...response });
expect(result.error).toContain('Insertion reported conflicts');
}
});
19 changes: 0 additions & 19 deletions scripts/atomicSyncArgs.test.mjs

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/fixtures/fakeAtomic.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion src/atomic/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as path from 'node:path';
import type { AtomicRepository } from 'nodeatomic' with { 'resolution-mode': 'import' };
import type { ViewSummary } from '../shared/atomicEvidence';

export type RepositoryClient = Pick<AtomicRepository, 'status' | 'add' | 'record' | 'log' | 'change' | 'views' | 'vault' | 'recordedFile'>;
export type RepositoryClient = Pick<AtomicRepository, 'status' | 'add' | 'record' | 'log' | 'change' | 'views' | 'vault' | 'recordedFile' | 'push' | 'pull' | 'remotes'>;
export type Status = Awaited<ReturnType<RepositoryClient['status']>>;
export type History = Awaited<ReturnType<RepositoryClient['log']>>;
export type Views = Awaited<ReturnType<RepositoryClient['views']['list']>>;
Expand Down
49 changes: 49 additions & 0 deletions src/atomic/operationResults.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import type { PushResponse, PullResponse, InsertViewResponse } from 'nodeatomic' with { 'resolution-mode': 'import' };

export type OperationResult = { lines: string[]; error?: string };

/** A successful native call can still report a refused push or a partial pull. */
export function pushResult(response: PushResponse): OperationResult {
if (response.conflict) {
const conflict = response.conflict;
return { lines: [], error: `View “${conflict.view}”: ${conflict.description}` };
}
const report = response.report;
if (!report) throw new Error('Atomic returned no push report. Install a compatible native runtime.');
const lines = (report.views ?? []).flatMap((view) => [
...(view.shrink ? [`Warning: remote view “${view.remoteName}” contains changes absent locally; its manifest was not reduced.`] : []),
...(view.forced ? [`Warning: remote view “${view.remoteName}” diverged; a forced push was attempted.`] : [])
]);
lines.push(`Push complete: ${response.pushedChanges} changes stored, ${report.viewsDeclared} views declared on ${report.remoteName}.`);
return { lines };
}

export function pullResult(response: PullResponse): OperationResult {
const report = response.report;
if (!report) throw new Error('Atomic returned no pull report. Install a compatible native runtime.');
const downloads = report.downloads ?? [];
const localOnly = report.localOnly ?? [];
const lines = (report.warnings ?? []).map((warning) => `Warning: ${warning.text}`);
if (localOnly.length) lines.push(`Warning: ${localOnly.length} local changes are not on the remote.`);
if (report.setIdWarning) lines.push(`Warning: ${report.setIdWarning}`);
const failures = [
...downloads.filter((download) => !download.ok).map((download) => download.error || 'A change failed to download.'),
...(report.applyErrors ?? []),
...(report.materializeError ? [`Working copy not updated: ${report.materializeError}`] : [])
];
if (String(report.changesFailed) !== '0' && !downloads.some((download) => !download.ok)) {
failures.push(`${report.changesFailed} changes failed to download.`);
}
lines.push(`${failures.length ? 'Pull completed with errors' : 'Pull complete'}: ${report.changesDownloaded} changes downloaded, ${response.appliedChanges} applied to ${report.localView}.`);
if (report.materialized) lines.push(`${report.filesWritten} working-copy files updated.`);
else if (report.applied && !report.materializeError) lines.push(`Working copy unchanged; switch to “${report.localView}” to inspect the pulled view.`);
return { lines, ...(failures.length ? { error: failures.join('\n') } : {}) };
}

export function insertResult(response: InsertViewResponse): OperationResult {
const lines = [`Inserted ${response.inserted.length} changes into “${response.resolvedTargetView}”; ${response.skippedCount} already present.`];
if (response.filesUpdated != null) lines.push(`${response.filesUpdated} working-copy files updated.`);
const conflicts = response.conflicts.map((conflict) => conflict.path).filter(Boolean);
return { lines, ...(response.hasConflicts || conflicts.length
? { error: `Insertion reported conflicts${conflicts.length ? `: ${conflicts.join(', ')}` : '.'}` } : {}) };
}
Loading
Loading