anhedral 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -6
- package/assets/contracts/deployment-provenance.json +6 -6
- package/assets/contracts/operations-provenance.json +2 -1
- package/assets/launch/oj/OJ.LICENSE +21 -0
- package/assets/launch/oj/run.mjs +82 -0
- package/assets/launch/oj/runtime.json +21 -0
- package/assets/launch/root.tsx.txt +1 -2
- package/assets/launch/server.ts.txt +4 -2
- package/assets/ui/catalog.json +36 -324
- package/dist/{platforms/web.d.ts → api-proxy.d.ts} +1 -3
- package/dist/api-proxy.js +48 -0
- package/dist/capability-catalog.d.ts +3 -57
- package/dist/capability-catalog.js +3 -90
- package/dist/capability-command.d.ts +10 -2
- package/dist/capability-command.js +35 -99
- package/dist/capability-editor.js +21 -1
- package/dist/capability-recipes.js +8 -343
- package/dist/cli-commands.js +6 -1
- package/dist/command-schema.js +141 -2
- package/dist/command-types.d.ts +1 -0
- package/dist/composition.d.ts +4 -14
- package/dist/composition.js +6 -6
- package/dist/contracts/cli-transport.d.ts +139 -40
- package/dist/contracts/cli-transport.js +96 -27
- package/dist/contracts/deployment.d.ts +7 -56
- package/dist/contracts/deployment.js +9 -45
- package/dist/contracts/production-transport.d.ts +71 -0
- package/dist/contracts/production-transport.js +56 -0
- package/dist/contracts/source-profile.js +1 -1
- package/dist/contracts/staging-transport.d.ts +2 -2
- package/dist/credential-helper.d.ts +2 -0
- package/dist/credential-helper.js +44 -0
- package/dist/dependencies.d.ts +0 -27
- package/dist/dependencies.js +3 -67
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -2
- package/dist/launch.d.ts +11 -5
- package/dist/launch.js +21 -9
- package/dist/platform-command.js +245 -42
- package/dist/platform-production.d.ts +16 -0
- package/dist/platform-production.js +135 -0
- package/dist/platform-state.d.ts +4 -1
- package/dist/platform-state.js +28 -5
- package/dist/platforms/tanstack.d.ts +2 -0
- package/dist/platforms/tanstack.js +113 -20
- package/dist/registry/usage.js +3 -1
- package/dist/release-artifact.d.ts +18 -0
- package/dist/release-artifact.js +169 -0
- package/dist/scaffold/bootstrap.d.ts +3 -3
- package/dist/scaffold/styling.d.ts +3 -2
- package/dist/stack-update.d.ts +39 -0
- package/dist/stack-update.js +346 -0
- package/dist/transaction.d.ts +1 -0
- package/dist/transaction.js +2 -0
- package/dist/ui-catalog.d.ts +3 -5
- package/dist/ui-catalog.js +8 -24
- package/dist/ui-command.d.ts +1 -1
- package/dist/ui-command.js +18 -57
- package/dist/ui-project.d.ts +2 -2
- package/dist/ui-project.js +8 -36
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/capabilities.md +7 -7
- package/docs/software-factory.md +83 -16
- package/docs/stack-standard.md +1 -1
- package/package.json +1 -4
- package/assets/stack/ai-schema.ts.txt +0 -5
- package/assets/stack/ai.ts.txt +0 -30
- package/assets/stack/desktop.rs.txt +0 -21
- package/assets/stack/event-retention.sql.txt +0 -10
- package/assets/stack/events-schema.ts.txt +0 -12
- package/assets/stack/events.ts.txt +0 -59
- package/assets/stack/mobile-auth.ts.txt +0 -25
- package/assets/stack/mobile-billing.tsx.txt +0 -63
- package/assets/stack/mobile-session.tsx.txt +0 -83
- package/assets/stack/native-button.tsx.txt +0 -108
- package/assets/stack/native-global.css.txt +0 -4
- package/assets/stack/native-lib-utils.ts.txt +0 -5
- package/assets/stack/native-metro.config.js.txt +0 -6
- package/assets/stack/native-nativewind-env.d.ts.txt +0 -1
- package/assets/stack/native-tailwind.config.js.txt +0 -73
- package/assets/stack/native-text.tsx.txt +0 -89
- package/assets/stack/purchases.ts.txt +0 -65
- package/assets/stack/revenuecat.ts.txt +0 -88
- package/assets/stack/rtc-schema.ts.txt +0 -10
- package/assets/stack/rtc.ts.txt +0 -122
- package/assets/stack/web-sign-in.tsx.txt +0 -51
- package/dist/capabilities.d.ts +0 -11
- package/dist/capabilities.js +0 -14
- package/dist/dependency-order.d.ts +0 -2
- package/dist/dependency-order.js +0 -24
- package/dist/platforms/lint.d.ts +0 -1
- package/dist/platforms/lint.js +0 -5
- package/dist/platforms/web.js +0 -251
- package/dist/project-config.d.ts +0 -3
- package/dist/project-config.js +0 -16
- package/dist/registry/context.d.ts +0 -3
- package/dist/registry/context.js +0 -20
- package/dist/registry/options.d.ts +0 -2
- package/dist/registry/options.js +0 -47
- package/dist/registry/resolve.d.ts +0 -11
- package/dist/registry/resolve.js +0 -46
- package/dist/registry/types.d.ts +0 -60
- package/dist/scaffold/api.d.ts +0 -2
- package/dist/scaffold/api.js +0 -38
- package/dist/scaffold/backend.d.ts +0 -2
- package/dist/scaffold/backend.js +0 -36
- package/dist/scaffold/compose.d.ts +0 -4
- package/dist/scaffold/compose.js +0 -30
- package/dist/scaffold/database.d.ts +0 -2
- package/dist/scaffold/database.js +0 -41
- package/dist/scaffold/documentation.d.ts +0 -2
- package/dist/scaffold/documentation.js +0 -71
- package/dist/scaffold/environment.d.ts +0 -4
- package/dist/scaffold/environment.js +0 -22
- package/dist/scaffold/stack-documentation.d.ts +0 -2
- package/dist/scaffold/stack-documentation.js +0 -6
- package/dist/scaffold/storage.d.ts +0 -2
- package/dist/scaffold/storage.js +0 -21
- package/dist/scaffold/workspace.d.ts +0 -3
- package/dist/scaffold/workspace.js +0 -141
- package/dist/stack-registry.d.ts +0 -35
- package/dist/stack-registry.js +0 -189
- package/dist/standard.d.ts +0 -8
- package/dist/standard.js +0 -109
- package/dist/workspace-graph.d.ts +0 -7
- package/dist/workspace-graph.js +0 -74
- /package/dist/{registry/types.js → command-types.js} +0 -0
package/dist/standard.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { writeProjectSection } from './project-config.js';
|
|
2
|
-
import { configureDependencyPatches } from './dependency-patches.js';
|
|
3
|
-
import { randomUUID } from 'node:crypto';
|
|
4
|
-
import { existsSync, lstatSync, mkdirSync, readdirSync, realpathSync, rmdirSync } from 'node:fs';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { spawnSync } from 'node:child_process';
|
|
7
|
-
import { execFile } from './util.js';
|
|
8
|
-
import { runStagedTransaction } from './transaction.js';
|
|
9
|
-
import { createSetupPlan } from './capabilities.js';
|
|
10
|
-
import { bootstrapWorkspace, assertWorkspaceRuntime } from './scaffold/bootstrap.js';
|
|
11
|
-
import { composeStack } from './scaffold/compose.js';
|
|
12
|
-
import { parseStandardOptions } from './registry/options.js';
|
|
13
|
-
import { STANDARD_USAGE } from './registry/usage.js';
|
|
14
|
-
import { printProgress, printResult } from './cli-output.js';
|
|
15
|
-
export { parseStandardOptions, STANDARD_USAGE };
|
|
16
|
-
export { STANDARD_PRODUCTS } from './stack-registry.js';
|
|
17
|
-
function assertInitDestination(root, allowRecovery = false) {
|
|
18
|
-
let info;
|
|
19
|
-
try {
|
|
20
|
-
info = lstatSync(root);
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
if (error.code === 'ENOENT')
|
|
24
|
-
return;
|
|
25
|
-
throw error;
|
|
26
|
-
}
|
|
27
|
-
if (info.isSymbolicLink() || !info.isDirectory())
|
|
28
|
-
throw Error('Destination must be a real directory.');
|
|
29
|
-
if (allowRecovery)
|
|
30
|
-
return;
|
|
31
|
-
const unexpected = readdirSync(root).filter((name) => !['.git', '.gitignore'].includes(name));
|
|
32
|
-
if (unexpected.length)
|
|
33
|
-
throw Error(`Destination must be empty (apart from .git/.gitignore): ${unexpected[0]}`);
|
|
34
|
-
}
|
|
35
|
-
export async function scaffoldStandardProject(options, run = execFile, output = {}) {
|
|
36
|
-
assertInitDestination(options.root, !options.dryRun);
|
|
37
|
-
const plan = createSetupPlan(options);
|
|
38
|
-
const display = { ...output, json: options.json };
|
|
39
|
-
if (options.dryRun) {
|
|
40
|
-
printResult('init', plan, { ...output, json: options.json });
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
assertWorkspaceRuntime(run);
|
|
44
|
-
const root = options.root;
|
|
45
|
-
const previousQuiet = process.env.ANHEDRAL_QUIET;
|
|
46
|
-
if (options.json)
|
|
47
|
-
process.env.ANHEDRAL_QUIET = '1';
|
|
48
|
-
let created = false;
|
|
49
|
-
try {
|
|
50
|
-
if (!existsSync(root)) {
|
|
51
|
-
mkdirSync(root, { recursive: true });
|
|
52
|
-
created = true;
|
|
53
|
-
}
|
|
54
|
-
assertInitDestination(root, true);
|
|
55
|
-
const commitPaths = [];
|
|
56
|
-
await runStagedTransaction(root, {
|
|
57
|
-
commitPaths,
|
|
58
|
-
seedPaths: existsSync(path.join(root, '.gitignore')) ? ['.gitignore'] : [],
|
|
59
|
-
prepare: () => {
|
|
60
|
-
const entries = readdirSync(root).filter((name) => !['.git', '.gitignore', '.anhedral.lock', '.anhedral-txn'].includes(name));
|
|
61
|
-
if (entries.length)
|
|
62
|
-
throw new Error(`Destination must be empty (apart from .git/.gitignore): ${entries[0]}`);
|
|
63
|
-
},
|
|
64
|
-
build: async (stageRoot) => {
|
|
65
|
-
printProgress('Creating the Next.js and Anhedral UI workspace…', display);
|
|
66
|
-
bootstrapWorkspace(stageRoot, options.name, run);
|
|
67
|
-
printProgress('Composing the selected stack…', display);
|
|
68
|
-
await composeStack(stageRoot, options, plan.registry);
|
|
69
|
-
writeProjectSection(stageRoot, 'identity', {
|
|
70
|
-
schemaVersion: 1,
|
|
71
|
-
id: randomUUID(),
|
|
72
|
-
});
|
|
73
|
-
if (!options.skipInstall) {
|
|
74
|
-
printProgress('Resolving pinned dependencies…', display);
|
|
75
|
-
run('pnpm', ['install', '--lockfile-only', '--no-frozen-lockfile'], stageRoot);
|
|
76
|
-
if (configureDependencyPatches(stageRoot))
|
|
77
|
-
run('pnpm', ['install', '--lockfile-only', '--no-frozen-lockfile'], stageRoot);
|
|
78
|
-
}
|
|
79
|
-
commitPaths.push(...readdirSync(stageRoot).filter((name) => name !== 'node_modules'));
|
|
80
|
-
},
|
|
81
|
-
afterCommit: () => {
|
|
82
|
-
if (options.initializeGit) {
|
|
83
|
-
const checkout = spawnSync('git', ['rev-parse', '--show-toplevel'], {
|
|
84
|
-
cwd: root,
|
|
85
|
-
encoding: 'utf8',
|
|
86
|
-
});
|
|
87
|
-
if (checkout.status !== 0 || realpathSync(checkout.stdout.trim()) !== realpathSync(root))
|
|
88
|
-
run('git', ['init'], root);
|
|
89
|
-
}
|
|
90
|
-
if (!options.skipInstall) {
|
|
91
|
-
printProgress('Installing workspace dependencies…', display);
|
|
92
|
-
run('pnpm', ['install', '--frozen-lockfile'], root);
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
printResult('init', {
|
|
97
|
-
...plan,
|
|
98
|
-
generated: true,
|
|
99
|
-
}, { ...output, json: options.json });
|
|
100
|
-
}
|
|
101
|
-
finally {
|
|
102
|
-
if (created && existsSync(root) && readdirSync(root).length === 0)
|
|
103
|
-
rmdirSync(root);
|
|
104
|
-
if (previousQuiet === undefined)
|
|
105
|
-
delete process.env.ANHEDRAL_QUIET;
|
|
106
|
-
else
|
|
107
|
-
process.env.ANHEDRAL_QUIET = previousQuiet;
|
|
108
|
-
}
|
|
109
|
-
}
|
package/dist/workspace-graph.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { readBoundedFile, MAX_PROJECT_JSON_BYTES } from './bounded-file.js';
|
|
2
|
-
import { existsSync, lstatSync, readdirSync } from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { dependencyOrder } from './dependency-order.js';
|
|
5
|
-
const dependencyFields = [
|
|
6
|
-
'dependencies',
|
|
7
|
-
'devDependencies',
|
|
8
|
-
'peerDependencies',
|
|
9
|
-
'optionalDependencies',
|
|
10
|
-
];
|
|
11
|
-
function readManifest(file, directory) {
|
|
12
|
-
if (!existsSync(file))
|
|
13
|
-
throw new Error(`Workspace manifest missing: ${directory}.`);
|
|
14
|
-
if (lstatSync(file).isSymbolicLink())
|
|
15
|
-
throw new Error(`Workspace symlinks are unsupported: ${directory}/package.json.`);
|
|
16
|
-
const value = JSON.parse(readBoundedFile(file, MAX_PROJECT_JSON_BYTES).toString('utf8'));
|
|
17
|
-
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
18
|
-
throw new Error(`Invalid workspace manifest: ${directory}.`);
|
|
19
|
-
const manifest = value;
|
|
20
|
-
if (typeof manifest.name !== 'string' || !manifest.name)
|
|
21
|
-
throw new Error(`Workspace name missing: ${directory}.`);
|
|
22
|
-
for (const field of dependencyFields) {
|
|
23
|
-
const dependencies = manifest[field];
|
|
24
|
-
if (dependencies === undefined)
|
|
25
|
-
continue;
|
|
26
|
-
if (!dependencies ||
|
|
27
|
-
typeof dependencies !== 'object' ||
|
|
28
|
-
Array.isArray(dependencies) ||
|
|
29
|
-
Object.values(dependencies).some((version) => typeof version !== 'string'))
|
|
30
|
-
throw new Error(`Invalid workspace dependencies: ${directory}/${field}.`);
|
|
31
|
-
}
|
|
32
|
-
return manifest;
|
|
33
|
-
}
|
|
34
|
-
/** Validate manifests and references, then traverse the indexed dependency graph. */
|
|
35
|
-
export function inspectWorkspaceGraph(root) {
|
|
36
|
-
const packages = new Map();
|
|
37
|
-
for (const group of ['apps', 'packages']) {
|
|
38
|
-
const parent = path.join(root, group);
|
|
39
|
-
if (!existsSync(parent))
|
|
40
|
-
continue;
|
|
41
|
-
if (lstatSync(parent).isSymbolicLink())
|
|
42
|
-
throw new Error(`Workspace symlinks are unsupported: ${group}.`);
|
|
43
|
-
for (const entry of readdirSync(parent, { withFileTypes: true })) {
|
|
44
|
-
const directory = `${group}/${entry.name}`;
|
|
45
|
-
if (entry.isSymbolicLink())
|
|
46
|
-
throw new Error(`Workspace symlinks are unsupported: ${directory}.`);
|
|
47
|
-
if (!entry.isDirectory())
|
|
48
|
-
continue;
|
|
49
|
-
const manifest = readManifest(path.join(root, directory, 'package.json'), directory);
|
|
50
|
-
if (packages.has(manifest.name))
|
|
51
|
-
throw new Error(`Duplicate workspace package: ${manifest.name}.`);
|
|
52
|
-
packages.set(manifest.name, { directory, manifest });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const graph = [...packages]
|
|
56
|
-
.map(([name, { directory, manifest }]) => {
|
|
57
|
-
const dependencies = new Set();
|
|
58
|
-
for (const field of dependencyFields) {
|
|
59
|
-
for (const [dependency, version] of Object.entries(manifest[field] ?? {})) {
|
|
60
|
-
if (!version.startsWith('workspace:'))
|
|
61
|
-
continue;
|
|
62
|
-
if (!['workspace:*', 'workspace:^', 'workspace:~'].includes(version))
|
|
63
|
-
throw new Error(`Unsupported workspace reference ${name} -> ${dependency}: ${version}.`);
|
|
64
|
-
if (!packages.has(dependency))
|
|
65
|
-
throw new Error(`Missing workspace dependency: ${name} -> ${dependency}.`);
|
|
66
|
-
dependencies.add(dependency);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return { name, directory, dependencies: [...dependencies].sort() };
|
|
70
|
-
})
|
|
71
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
72
|
-
dependencyOrder(new Map(graph.map((node) => [node.name, node.dependencies])), 'Workspace');
|
|
73
|
-
return graph;
|
|
74
|
-
}
|
|
File without changes
|