cohorte 3.0.0-dev.0 → 3.0.0-dev.1
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/assets/manifest.json +4 -4
- package/assets/schemas/reconcile-plan.schema.json +1 -2
- package/dist/agent-host.mjs +2142 -5
- package/dist/agent-host.mjs.map +1 -1
- package/dist/bundle-manifest.json +28 -26
- package/dist/chunks/{auth-D8rCVY33.mjs → auth-CYOh60KG.mjs} +10 -1
- package/dist/chunks/auth-CYOh60KG.mjs.map +1 -0
- package/dist/chunks/{brainstorm-CU10T1tm.mjs → brainstorm-BwKA6yZP.mjs} +2 -2
- package/dist/chunks/{brainstorm-CU10T1tm.mjs.map → brainstorm-BwKA6yZP.mjs.map} +1 -1
- package/dist/chunks/{compose-Cr0hP0qm.mjs → compose-Dvxunpto.mjs} +3333 -3329
- package/dist/chunks/compose-Dvxunpto.mjs.map +1 -0
- package/dist/chunks/{contract-B0ra2-bm.mjs → contract-BkMjU1kR.mjs} +2 -2
- package/dist/chunks/{contract-B0ra2-bm.mjs.map → contract-BkMjU1kR.mjs.map} +1 -1
- package/dist/chunks/{contract-vYbwYr0Y.mjs → contract-bQ9FJl4N.mjs} +2 -2
- package/dist/chunks/contract-bQ9FJl4N.mjs.map +1 -0
- package/dist/chunks/{discover-30Ciya_0.mjs → discover-eS01-me1.mjs} +3 -2
- package/dist/chunks/{discover-30Ciya_0.mjs.map → discover-eS01-me1.mjs.map} +1 -1
- package/dist/chunks/{doctor-DfCrKpfT.mjs → doctor-B-H2UK5e.mjs} +2 -2
- package/dist/chunks/{doctor-DfCrKpfT.mjs.map → doctor-B-H2UK5e.mjs.map} +1 -1
- package/dist/chunks/init-BUnzIkeE.mjs +63 -0
- package/dist/chunks/init-BUnzIkeE.mjs.map +1 -0
- package/dist/chunks/migrate-DybihKzZ.mjs +33 -0
- package/dist/chunks/migrate-DybihKzZ.mjs.map +1 -0
- package/dist/chunks/reconcile-Bhy3IIYo.mjs +50 -0
- package/dist/chunks/reconcile-Bhy3IIYo.mjs.map +1 -0
- package/dist/chunks/scan-8Gy_B6kI.mjs +122 -0
- package/dist/chunks/scan-8Gy_B6kI.mjs.map +1 -0
- package/dist/chunks/src-CmFjh4M0.mjs +928 -0
- package/dist/chunks/src-CmFjh4M0.mjs.map +1 -0
- package/dist/cli.mjs +10 -10
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/auth-D8rCVY33.mjs.map +0 -1
- package/dist/chunks/compose-Cr0hP0qm.mjs.map +0 -1
- package/dist/chunks/contract-vYbwYr0Y.mjs.map +0 -1
- package/dist/chunks/init-Okz4mlhW.mjs +0 -30
- package/dist/chunks/init-Okz4mlhW.mjs.map +0 -1
- package/dist/chunks/migrate-DRoFUg53.mjs +0 -19
- package/dist/chunks/migrate-DRoFUg53.mjs.map +0 -1
- package/dist/chunks/reconcile-BfD785gd.mjs +0 -26
- package/dist/chunks/reconcile-BfD785gd.mjs.map +0 -1
- package/dist/chunks/src-JxawBQBn.mjs +0 -446
- package/dist/chunks/src-JxawBQBn.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-CmFjh4M0.mjs","names":[],"sources":["../../../../packages/project-model/src/desired/index.ts","../../../../packages/project-model/src/drift/index.ts","../../../../packages/project-model/src/import-v2/index.ts","../../../../packages/project-model/src/init/index.ts","../../../../packages/project-model/src/reconcile/index.ts"],"sourcesContent":["import { canonicalJson, type JsonValue, sha256Hex } from '@cohorte/base';\nimport type { CohorteConfig } from '@cohorte/config/schema';\nimport { stringify } from 'yaml';\nimport type { DesiredState, ProjectModel } from '../contract.ts';\n\nexport interface DesiredStateInput {\n model: ProjectModel;\n config: CohorteConfig;\n cohorteVersion: string;\n /** skill id -> version */\n skills: Readonly<Record<string, string>>;\n}\n\nexport function deriveDesiredState(input: DesiredStateInput): DesiredState {\n const modelYaml = stringify(input.model);\n const generatedArtifacts = new Map<string, string>();\n for (const path of input.model.generatedArtifacts.value) {\n const relative = path.replace(/^\\.cohorte\\//u, '');\n if (relative === 'manifest.yaml' || relative === 'project.yaml') continue;\n generatedArtifacts.set(\n relative,\n canonicalJson({\n path: relative,\n model: input.model,\n config: input.config,\n skills: input.skills,\n } as unknown as JsonValue),\n );\n }\n const manifest = {\n schemaVersion: 1,\n cohorteVersion: input.cohorteVersion,\n createdWith: input.cohorteVersion,\n protocol: { min: '3.0', max: '3.x' },\n stateSchemaVersion: 1,\n generated: [\n {\n path: 'project.yaml',\n templateId: 'project-model/v1',\n templateSha256: sha256Hex(modelYaml),\n renderedSha256: sha256Hex(modelYaml),\n },\n {\n path: '.gitignore',\n templateId: 'cohorte/gitignore/v1',\n templateSha256: sha256Hex('state/\\nruns/\\n'),\n renderedSha256: sha256Hex('state/\\nruns/\\n'),\n },\n {\n path: 'generated/.gitkeep',\n templateId: 'cohorte/generated-dir/v1',\n templateSha256: sha256Hex(''),\n renderedSha256: sha256Hex(''),\n },\n ...[...generatedArtifacts.keys()].map((path) => ({\n path,\n templateId: path,\n templateSha256: sha256Hex(generatedArtifacts.get(path) as string),\n renderedSha256: sha256Hex(generatedArtifacts.get(path) as string),\n })),\n ],\n };\n const manifestYaml = stringify(manifest);\n const builtin: Record<string, string> = {\n 'manifest.yaml': manifestYaml,\n 'project.yaml': modelYaml,\n 'config.yaml': 'schemaVersion: 1\\n',\n 'ownership.yaml': 'surfaces: {}\\n',\n '.gitignore': 'state/\\nruns/\\n',\n 'generated/.gitkeep': '',\n };\n const files = new Set([...Object.keys(builtin), ...generatedArtifacts.keys()]);\n const stateFiles = [...files].sort().map((path) => ({\n path,\n class: path === 'config.yaml' || path === 'ownership.yaml' ? ('human' as const) : ('generated' as const),\n sha256: sha256Hex(builtin[path] ?? generatedArtifacts.get(path) ?? ''),\n content: builtin[path] ?? generatedArtifacts.get(path) ?? '',\n ...(input.skills[path] === undefined ? {} : { templateId: path }),\n }));\n return { cohorteVersion: input.cohorteVersion, files: stateFiles };\n}\n","import { readdir, readFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport { type Clock, sha256Hex } from '@cohorte/base';\nimport { parse } from 'yaml';\nimport type { ActualState, DesiredState, DriftEntry, DriftReport } from '../contract.ts';\n\nexport async function readActualState(root: string): Promise<ActualState> {\n const stateRoot = join(root, '.cohorte');\n let manifest = null;\n try {\n manifest = parse(await readFile(join(stateRoot, 'manifest.yaml'), 'utf8')) as ActualState['manifest'];\n } catch {\n return { manifest: null, files: [] };\n }\n const files: ActualState['files'] = [];\n const visit = async (dir: string): Promise<void> => {\n try {\n const entries = await readdir(dir, { withFileTypes: true });\n for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n if (entry.name === 'state' || entry.name === 'runs') continue;\n const path = join(dir, entry.name);\n if (entry.isDirectory()) await visit(path);\n else if (entry.isFile()) {\n const bytes = await readFile(path);\n const relativePath = relative(stateRoot, path).split('\\\\').join('/');\n const generated =\n relativePath === 'manifest.yaml'\n ? { path: relativePath, templateId: 'cohorte/manifest/v1', renderedSha256: sha256Hex(bytes) }\n : manifest?.generated.find((item) => item.path === relativePath);\n files.push({\n path: relativePath,\n class: generated ? 'generated' : 'human',\n sha256: sha256Hex(bytes),\n ...(generated?.templateId ? { templateId: generated.templateId } : {}),\n });\n }\n }\n } catch {\n return;\n }\n };\n await visit(stateRoot);\n return { manifest, files };\n}\n\nexport function diffStates(desired: DesiredState, actual: ActualState, clock: Clock): DriftReport {\n const desiredByPath = new Map(desired.files.map((file) => [file.path, file]));\n const actualByPath = new Map(actual.files.map((file) => [file.path, file]));\n const recorded = new Map((actual.manifest?.generated ?? []).map((file) => [file.path, file.renderedSha256]));\n const paths = [...new Set([...desiredByPath.keys(), ...actualByPath.keys()])].sort();\n const entries = paths.flatMap((path): DriftEntry[] => {\n const expected = desiredByPath.get(path);\n const found = actualByPath.get(path);\n const recordedSha256 = recorded.get(path);\n if (!found && expected)\n return [\n {\n target: path,\n class: expected.class,\n diff: 'absent' as const,\n desiredSha256: expected.sha256,\n ...(recordedSha256 ? { recordedSha256 } : {}),\n detail: 'desired file is absent',\n },\n ];\n if (found && !expected)\n return [\n {\n target: path,\n class: found.class,\n diff: found.class === 'generated' ? ('potential-deletion' as const) : ('unknown' as const),\n actualSha256: found.sha256,\n ...(recordedSha256 ? { recordedSha256 } : {}),\n detail: 'file exists but is not desired',\n },\n ];\n if (!found || !expected) throw new Error('unreachable drift entry');\n if (found.sha256 === expected.sha256) return [];\n if (found.class === 'human')\n return [\n {\n target: path,\n class: found.class,\n diff: 'human-change' as const,\n desiredSha256: expected.sha256,\n actualSha256: found.sha256,\n ...(recordedSha256 ? { recordedSha256 } : {}),\n detail: 'content changed in a human-owned file',\n },\n ];\n if (recordedSha256 === undefined || found.sha256 === recordedSha256)\n return [\n {\n target: path,\n class: expected.class,\n diff: 'expected-change' as const,\n desiredSha256: expected.sha256,\n actualSha256: found.sha256,\n ...(recordedSha256 ? { recordedSha256 } : {}),\n detail: 'generated content differs from the previous render',\n },\n ];\n return [\n {\n target: path,\n class: found.class,\n diff: 'conflict' as const,\n desiredSha256: expected.sha256,\n actualSha256: found.sha256,\n recordedSha256,\n detail: 'content changed since the recorded render',\n },\n ];\n });\n return { schemaVersion: 1, generatedAt: clock.now(), entries };\n}\n","import { createHash } from 'node:crypto';\nimport { cp, lstat, mkdir, readdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';\nimport { dirname, join, relative, resolve, sep } from 'node:path';\nimport { canonicalJson, sha256Hex } from '@cohorte/base';\nimport { DEFAULT_CONFIG, type Spec, specContentSha256 } from '@cohorte/config/schema';\nimport { parse, stringify } from 'yaml';\nimport type { ProjectModel } from '../contract.ts';\n\nconst FORMAT = 'cohorte-v2-export';\nconst MAX_FILE_BYTES = 10 * 1024 * 1024;\nconst SKIP_DIRS = new Set(['.git', 'node_modules', '.build', 'dist', 'coverage', '.cohorte']);\nconst SECRET =\n /(^|[/\\\\])(?:\\.env(?:\\..*)?|credentials?(?:\\..*)?|secrets?(?:\\..*)?|.*token.*|.*password.*|.*api[-_]?key.*)$/iu;\n\nexport interface V2ExportFile {\n path: string;\n sha256: string;\n bytes: number;\n kind: 'config' | 'spec' | 'history' | 'marker';\n}\n\nexport interface V2ExportManifest {\n format: typeof FORMAT;\n version: 1;\n sourceVersion: string | null;\n createdAt: string;\n projectRootDigest: string;\n files: V2ExportFile[];\n excluded: Array<{ path: string; reason: string }>;\n warnings: V2ImportWarning[];\n}\n\nexport interface V2ImportWarning {\n code: string;\n path?: string;\n message: string;\n blocking: boolean;\n}\n\nexport interface V2ExportOptions {\n root: string;\n destination: string;\n now?: string;\n}\n\nexport interface V2ExportResult {\n bundleRoot: string;\n manifest: V2ExportManifest;\n checksumsPath: string;\n}\n\nexport interface V2ImportFile {\n path: string;\n content: string;\n action: 'create' | 'replace' | 'keep' | 'conflict';\n reason: string;\n}\n\nexport interface V2ImportPlan {\n bundleRoot: string;\n projectRoot: string;\n sourceVersion: string | null;\n files: V2ImportFile[];\n warnings: V2ImportWarning[];\n conflicts: string[];\n sourceDigest: string;\n targetDigest: string;\n}\n\nexport interface V2ImportOptions {\n model?: ProjectModel;\n}\n\nexport interface V2ImportReport {\n reportId: string;\n status: 'applied' | 'rolled-back';\n bundleRoot: string;\n projectRoot: string;\n backupRoot: string;\n sourceDigest: string;\n targetDigest: string;\n files: string[];\n warnings: V2ImportWarning[];\n createdAt: string;\n}\n\nexport const V2_IMPORT_FAULT_POINTS = [\n 'before-backup',\n 'after-backup',\n 'after-stage',\n 'before-rename',\n 'after-rename',\n 'before-report',\n] as const;\n\nexport type V2ImportFaultPoint = (typeof V2_IMPORT_FAULT_POINTS)[number];\n\ninterface BundleInput {\n manifest: V2ExportManifest;\n files: Map<string, string>;\n sourceDigest: string;\n}\n\nfunction normalisePath(value: string): string {\n const path = value.replaceAll('\\\\', '/');\n if (!path || path.startsWith('/') || path.split('/').some((part) => part === '..' || part === ''))\n throw new Error(`configuration/import-invalid: unsafe relative path ${JSON.stringify(value)}`);\n return path;\n}\n\nasync function walk(root: string, current = root): Promise<string[]> {\n const entries = await readdir(current, { withFileTypes: true });\n const result: string[] = [];\n for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n if (entry.isDirectory() && SKIP_DIRS.has(entry.name)) continue;\n const absolute = join(current, entry.name);\n const rel = relative(root, absolute).split(sep).join('/');\n if (entry.isSymbolicLink()) throw new Error(`configuration/import-symlink: refusing symbolic link ${rel}`);\n if (entry.isDirectory()) result.push(...(await walk(root, absolute)));\n else if (entry.isFile()) result.push(rel);\n }\n return result.sort();\n}\n\nfunction fileKind(path: string): V2ExportFile['kind'] {\n if (path === 'PIPELINE.md' || path === 'cohorte.config.yaml' || path.startsWith('profile/')) return 'config';\n if (path.startsWith('specs/')) return path.startsWith('specs/reports/') ? 'history' : 'spec';\n return 'marker';\n}\n\nfunction warning(code: string, message: string, path?: string, blocking = false): V2ImportWarning {\n return { code, message, ...(path === undefined ? {} : { path }), blocking };\n}\n\nasync function digestFiles(root: string, files: string[]): Promise<string> {\n const hash = createHash('sha256');\n for (const path of files) {\n hash.update(path);\n hash.update(await readFile(join(root, path)));\n }\n return hash.digest('hex');\n}\n\nfunction sourceVersion(pipeline: string | undefined): string | null {\n const match = pipeline?.match(/(?:version|core_version)\\s*[:=]\\s*[\"']?([0-9]+\\.[0-9]+\\.[0-9]+)/iu);\n return match?.[1] ?? null;\n}\n\nexport async function exportV2(options: V2ExportOptions): Promise<V2ExportResult> {\n const root = resolve(options.root);\n const destination = resolve(options.destination);\n const all = await walk(root);\n const files: V2ExportFile[] = [];\n const excluded: V2ExportManifest['excluded'] = [];\n const warnings: V2ImportWarning[] = [];\n for (const path of all) {\n if (SECRET.test(path)) {\n excluded.push({ path, reason: 'sensitive-path' });\n warnings.push(warning('sensitive-excluded', 'sensitive file excluded from export', path));\n continue;\n }\n const info = await stat(join(root, path));\n if (info.size > MAX_FILE_BYTES) {\n excluded.push({ path, reason: 'file-too-large' });\n warnings.push(warning('file-too-large', `file exceeds ${MAX_FILE_BYTES} bytes`, path, true));\n continue;\n }\n const content = await readFile(join(root, path));\n files.push({ path, sha256: sha256Hex(content), bytes: content.byteLength, kind: fileKind(path) });\n }\n const selected = files.map((file) => file.path);\n const pipeline = all.includes('PIPELINE.md') ? await readFile(join(root, 'PIPELINE.md'), 'utf8') : undefined;\n const manifest: V2ExportManifest = {\n format: FORMAT,\n version: 1,\n sourceVersion: sourceVersion(pipeline),\n createdAt: options.now ?? new Date().toISOString(),\n projectRootDigest: await digestFiles(root, selected),\n files,\n excluded,\n warnings,\n };\n await rm(destination, { recursive: true, force: true });\n await mkdir(join(destination, 'files'), { recursive: true, mode: 0o700 });\n for (const file of files) {\n const target = join(destination, 'files', file.path);\n await mkdir(dirname(target), { recursive: true, mode: 0o700 });\n await writeFile(target, await readFile(join(root, file.path)), { mode: 0o600 });\n }\n await writeFile(join(destination, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\\n`, { mode: 0o600 });\n const checksums = files\n .map((file) => `${file.sha256} files/${file.path}`)\n .concat(`${sha256Hex(canonicalJson(manifest as never))} manifest.json`)\n .join('\\n');\n const checksumsPath = join(destination, 'checksums.sha256');\n await writeFile(checksumsPath, `${checksums}\\n`, { mode: 0o600 });\n return { bundleRoot: destination, manifest, checksumsPath };\n}\n\nasync function readBundle(bundleRoot: string): Promise<BundleInput> {\n const root = resolve(bundleRoot);\n const manifestPath = join(root, 'manifest.json');\n const manifestInfo = await lstat(manifestPath);\n if (!manifestInfo.isFile() || manifestInfo.isSymbolicLink())\n throw new Error('security/import-invalid: manifest must be a regular file');\n const manifestText = await readFile(manifestPath, 'utf8');\n const manifest = JSON.parse(manifestText) as V2ExportManifest;\n if (manifest.format !== FORMAT || manifest.version !== 1)\n throw new Error('configuration/import-invalid: unsupported V2 export format');\n const files = new Map<string, string>();\n const expectedChecksums = new Map<string, string>();\n const checksums = await readFile(join(root, 'checksums.sha256'), 'utf8');\n for (const line of checksums\n .split('\\n')\n .map((item) => item.trim())\n .filter(Boolean)) {\n const match = line.match(/^([0-9a-f]{64}) {2}(.+)$/u);\n if (!match?.[1] || !match[2]) throw new Error('security/import-invalid: malformed checksums file');\n expectedChecksums.set(match[2], match[1]);\n }\n if (expectedChecksums.get('manifest.json') !== sha256Hex(canonicalJson(manifest as never)))\n throw new Error('security/import-checksum-mismatch: manifest.json');\n for (const entry of manifest.files) {\n const path = normalisePath(entry.path);\n if (files.has(path)) throw new Error(`configuration/import-invalid: duplicate path ${path}`);\n const filePath = join(root, 'files', path);\n const info = await lstat(filePath);\n if (!info.isFile() || info.isSymbolicLink())\n throw new Error(`security/import-invalid: symlink or non-file ${path}`);\n const content = await readFile(filePath, 'utf8');\n if (sha256Hex(content) !== entry.sha256) throw new Error(`security/import-checksum-mismatch: ${path}`);\n if (expectedChecksums.get(`files/${path}`) !== entry.sha256)\n throw new Error(`security/import-checksum-mismatch: files/${path}`);\n files.set(path, content);\n }\n const sourceDigest = await digestFiles(join(root, 'files'), [...files.keys()]);\n if (sourceDigest !== manifest.projectRootDigest)\n throw new Error('security/import-checksum-mismatch: project root digest does not match manifest');\n return { manifest, files, sourceDigest };\n}\n\nfunction pipelineBlock(input: string | undefined): Record<string, unknown> {\n const match = input?.match(/```ya?ml\\s+pipeline-profile\\s*\\n([\\s\\S]*?)\\n```/iu);\n if (!match?.[1]) return {};\n try {\n const parsed = parse(match[1]) as unknown;\n return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? (parsed as Record<string, unknown>) : {};\n } catch {\n return {};\n }\n}\n\nfunction rule(id: string, program: string, decision: 'allow' | 'ask' | 'deny') {\n return { id, program, decision, replay: 'idempotent' as const, network: false, origin: 'project-config' as const };\n}\n\nfunction mapConfig(\n input: string | undefined,\n pipeline: string | undefined,\n model: ProjectModel | undefined,\n): { config: string; ownership: string; warnings: V2ImportWarning[] } {\n const warnings: V2ImportWarning[] = [];\n let document: Record<string, unknown> = {};\n if (input !== undefined) {\n try {\n const parsed = parse(input) as unknown;\n if (parsed && typeof parsed === 'object') document = parsed as Record<string, unknown>;\n } catch {\n warnings.push(warning('config-invalid-yaml', 'V2 configuration is not valid YAML', 'cohorte.config.yaml', true));\n }\n }\n const profile = pipelineBlock(pipeline);\n if (profile.name === undefined)\n warnings.push(warning('config-project-id-missing', 'project id needs human confirmation'));\n if (document.kanban !== undefined)\n warnings.push(warning('kanban-not-imported', 'Kanban links remain external and are not synchronized'));\n const id = typeof profile.name === 'string' ? profile.name : 'imported-project';\n const vcs = (profile.vcs ?? {}) as Record<string, unknown>;\n const commands = (profile.commands ?? {}) as Record<string, unknown>;\n const gate = (profile.gate ?? {}) as Record<string, unknown>;\n const defaultBranch =\n typeof vcs.default_branch === 'string' ? vcs.default_branch : DEFAULT_CONFIG.project.defaultBranch;\n const branchPrefix =\n typeof vcs.feature_branch_prefix === 'string' ? vcs.feature_branch_prefix : DEFAULT_CONFIG.git.branchPrefix;\n const migrated = structuredClone(DEFAULT_CONFIG);\n migrated.project = { ...migrated.project, id, defaultBranch, protectedBranches: [defaultBranch] };\n migrated.git = { ...migrated.git, branchPrefix };\n migrated.checks = {\n ...migrated.checks,\n ...(typeof commands.test === 'string' ? { test: commands.test.split(/\\s+/u) } : {}),\n ...(typeof commands.lint === 'string' ? { lint: commands.lint.split(/\\s+/u) } : {}),\n ...(typeof commands.typecheck === 'string' ? { typecheck: commands.typecheck.split(/\\s+/u) } : {}),\n };\n const deny = Array.isArray(gate.deny) ? gate.deny.filter((v): v is string => typeof v === 'string') : [];\n const ask = Array.isArray(gate.ask) ? gate.ask.filter((v): v is string => typeof v === 'string') : [];\n migrated.policy.commands = {\n allow: [],\n ask: ask.map((value, index) => rule(`v2-ask-${index}`, value.split(/\\s+/u)[0] ?? value, 'ask')),\n deny: deny.map((value, index) => rule(`v2-deny-${index}`, value.split(/\\s+/u)[0] ?? value, 'deny')),\n };\n warnings.push(\n warning('runtime-review-required', 'V2 runtime adapters are not migrated; review the current runtime selection'),\n );\n const surfaces = Object.fromEntries(\n Object.entries(model?.surfaces ?? {}).map(([key, value]) => [\n key,\n { paths: value.paths.value, owners: ['implementer'], reviewers: ['reviewer'] },\n ]),\n );\n return {\n config: stringify(migrated),\n ownership: stringify({ surfaces }),\n warnings,\n };\n}\n\nfunction section(markdown: string, number: string, fallback: string): string {\n const match = markdown.match(new RegExp(`^##\\\\s+${number}\\\\.?.*?\\\\n([\\\\s\\\\S]*?)(?=^##\\\\s+|$)`, 'imu'));\n return match?.[1]?.trim() ?? fallback;\n}\n\nfunction bullets(text: string): string[] {\n return text\n .split('\\n')\n .map((line) => line.match(/^\\s*(?:[-*]|\\d+[.)])\\s+(.*)$/u)?.[1]?.trim())\n .filter((value): value is string => Boolean(value));\n}\n\nfunction importedSpec(path: string, markdown: string): { id: string; content: string; warning?: V2ImportWarning } {\n const front = markdown.match(/^---\\s*\\n([\\s\\S]*?)\\n---/u);\n const metadata = front?.[1] ? (parse(front[1]) as Record<string, unknown>) : {};\n const filename = path.split('/').pop()?.replace(/\\.md$/iu, '') ?? 'imported-spec';\n const id =\n String(metadata.feature_id ?? filename)\n .toLowerCase()\n .replace(/[^a-z0-9]+/gu, '-')\n .replace(/^-|-$/gu, '')\n .slice(0, 48) || 'imported-spec';\n const heading = markdown.match(/^#\\s+(.+)$/mu)?.[1]?.trim();\n const title = String(metadata.title ?? heading ?? id);\n const rawStatus = String(metadata.status ?? 'draft');\n const status = rawStatus === 'draft' ? 'draft' : 'frozen';\n const acceptance = bullets(section(markdown, '9', ''));\n const openQuestions = bullets(section(markdown, '10', ''));\n const surfaces: Record<string, { tasks: string[] }> = {};\n const surfaceSection = section(markdown, '6', '');\n for (const match of surfaceSection.matchAll(/^###\\s+([^\\n]+)\\n([\\s\\S]*?)(?=^###\\s+|$)/gmu)) {\n const key =\n match[1]\n ?.trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/gu, '-')\n .replace(/^-|-$/gu, '') || 'shared';\n surfaces[key] = { tasks: bullets(match[2] ?? '') };\n }\n if (Object.keys(surfaces).length === 0)\n surfaces.shared = { tasks: ['Review imported V2 specification and assign implementation tasks.'] };\n const body = {\n id,\n kind: 'feature' as const,\n status,\n title,\n acceptance: acceptance.length ? acceptance : [`Review imported V2 specification: ${title}`],\n surfaces,\n openQuestions: [...openQuestions, ...(rawStatus === 'draft' ? [] : [`Original V2 status: ${rawStatus}`])],\n } as Spec;\n if (status === 'frozen') return { id, content: stringify({ ...body, sha256: specContentSha256(body) }) };\n return {\n id,\n content: stringify(body),\n ...(rawStatus === 'draft'\n ? {}\n : { warning: warning('spec-status-normalized', `V2 status ${rawStatus} was normalized to frozen`, path) }),\n };\n}\n\nexport async function planV2Import(\n bundleRoot: string,\n projectRoot: string,\n options: V2ImportOptions = {},\n): Promise<V2ImportPlan> {\n const bundle = await readBundle(bundleRoot);\n const modelSource = bundle.files.get('PIPELINE.md');\n const mapped = mapConfig(bundle.files.get('cohorte.config.yaml'), modelSource, options.model);\n const projectContent = options.model === undefined ? undefined : stringify(options.model);\n const generated =\n projectContent === undefined\n ? []\n : [\n {\n path: 'project.yaml',\n templateId: 'project-model/v1',\n templateSha256: sha256Hex(projectContent),\n renderedSha256: sha256Hex(projectContent),\n },\n ];\n const manifestContent = stringify({\n schemaVersion: 1,\n cohorteVersion: '3.0.0',\n createdWith: 'v2-import',\n protocol: { min: '3.0', max: '3.x' },\n stateSchemaVersion: 1,\n generated,\n });\n const convertedSpecs = bundle.manifest.files\n .filter((entry) => entry.kind === 'spec')\n .map((entry) => ({ entry, converted: importedSpec(entry.path, bundle.files.get(entry.path) ?? '') }));\n const specWarnings = convertedSpecs.flatMap(({ converted }) => (converted.warning ? [converted.warning] : []));\n const files: V2ImportFile[] = [\n { path: '.cohorte/manifest.yaml', content: manifestContent, action: 'create', reason: 'V3 migration marker' },\n { path: '.cohorte/.gitignore', content: 'state/\\nruns/\\n', action: 'create', reason: 'protect V3 local state' },\n { path: '.cohorte/config.yaml', content: mapped.config, action: 'create', reason: 'mapped V2 configuration' },\n {\n path: '.cohorte/ownership.yaml',\n content: mapped.ownership,\n action: 'create',\n reason: 'new V3 ownership document',\n },\n ...(options.model === undefined\n ? []\n : [\n {\n path: '.cohorte/project.yaml',\n content: projectContent ?? '',\n action: 'create' as const,\n reason: 'deterministic V3 project model generated during import',\n },\n ]),\n ...(modelSource === undefined\n ? []\n : [\n {\n path: '.cohorte/import-source/PIPELINE.md',\n content: modelSource,\n action: 'create' as const,\n reason: 'preserve V2 source',\n },\n ]),\n ...convertedSpecs.map(({ entry, converted }) => ({\n path: `.cohorte/specs/${converted.id}.yaml`,\n content: converted.content,\n action: 'create' as const,\n reason: `convert V2 Markdown specification ${entry.path} to native schema`,\n })),\n ...bundle.manifest.files\n .filter((entry) => entry.kind === 'history')\n .map((entry) => ({\n path: `.cohorte/artifacts/v2-history/${normalisePath(entry.path).replace(/^specs\\/reports\\//u, '')}`,\n content: bundle.files.get(entry.path) ?? '',\n action: 'create' as const,\n reason: 'import V2 historical artifact',\n })),\n ];\n const currentDigest = await digestProject(projectRoot);\n const conflicts: string[] = [];\n for (const file of files) {\n try {\n const currentPath = join(projectRoot, file.path);\n const info = await lstat(currentPath);\n if (info.isSymbolicLink()) {\n file.action = 'conflict';\n file.reason = 'target is a symbolic link';\n conflicts.push(file.path);\n continue;\n }\n const current = await readFile(currentPath, 'utf8');\n if (current !== file.content) {\n file.action = 'conflict';\n file.reason = 'target exists with different content';\n conflicts.push(file.path);\n } else file.action = 'keep';\n } catch {\n /* create */\n }\n }\n return {\n bundleRoot: resolve(bundleRoot),\n projectRoot: resolve(projectRoot),\n sourceVersion: bundle.manifest.sourceVersion,\n files,\n warnings: [...bundle.manifest.warnings, ...mapped.warnings, ...specWarnings],\n conflicts,\n sourceDigest: bundle.sourceDigest,\n targetDigest: currentDigest,\n };\n}\n\nasync function digestProject(root: string): Promise<string> {\n const paths = (await walk(root)).filter((path) => !path.startsWith('.cohorte/import-preview/'));\n return digestFiles(root, paths);\n}\n\nexport async function applyV2Import(\n plan: V2ImportPlan,\n options: {\n confirm: boolean;\n backupRoot: string;\n now?: string;\n fault?: (point: V2ImportFaultPoint) => void;\n },\n): Promise<V2ImportReport> {\n if (plan.conflicts.length) throw new Error(`configuration/import-conflict: ${plan.conflicts.join(', ')}`);\n if (plan.warnings.some((item) => item.blocking))\n throw new Error('configuration/import-blocked: resolve blocking warnings first');\n if (!options.confirm) throw new Error('configuration/import-confirmation-required: rerun with explicit confirmation');\n if ((await digestProject(plan.projectRoot)) !== plan.targetDigest)\n throw new Error('configuration/import-project-changed: project changed since preview');\n const id = sha256Hex(`${plan.sourceDigest}:${plan.targetDigest}:${options.now ?? new Date().toISOString()}`).slice(\n 0,\n 16,\n );\n const backupRoot = resolve(options.backupRoot, `cohorte-v2-${id}`);\n const stage = join(backupRoot, '.stage');\n const reportPath = join(plan.projectRoot, '.cohorte', 'import-reports', `${id}.json`);\n const existing: string[] = [];\n let mutated = false;\n const restore = async () => {\n await rm(stage, { recursive: true, force: true });\n await rm(reportPath, { force: true });\n if (!mutated) return;\n for (const file of plan.files) {\n if (file.action === 'keep') continue;\n const target = join(plan.projectRoot, file.path);\n const backup = join(backupRoot, file.path);\n try {\n await stat(backup);\n await mkdir(dirname(target), { recursive: true, mode: 0o700 });\n await cp(backup, target, { recursive: true, verbatimSymlinks: true });\n } catch {\n await rm(target, { recursive: true, force: true });\n }\n }\n };\n try {\n options.fault?.('before-backup');\n await mkdir(backupRoot, { recursive: true, mode: 0o700 });\n for (const file of plan.files) {\n try {\n await lstat(join(plan.projectRoot, file.path));\n existing.push(file.path);\n await mkdir(dirname(join(backupRoot, file.path)), { recursive: true, mode: 0o700 });\n await cp(join(plan.projectRoot, file.path), join(backupRoot, file.path), {\n recursive: true,\n verbatimSymlinks: true,\n });\n } catch {\n /* new file */\n }\n }\n options.fault?.('after-backup');\n await mkdir(stage, { recursive: true, mode: 0o700 });\n for (const file of plan.files) {\n if (file.action === 'keep') continue;\n const target = join(stage, file.path);\n await mkdir(dirname(target), { recursive: true, mode: 0o700 });\n await writeFile(target, file.content, { mode: 0o600 });\n }\n options.fault?.('after-stage');\n options.fault?.('before-rename');\n for (const file of plan.files) {\n if (file.action === 'keep') continue;\n const target = join(plan.projectRoot, file.path);\n await mkdir(dirname(target), { recursive: true, mode: 0o700 });\n mutated = true;\n await rename(join(stage, file.path), target);\n }\n options.fault?.('after-rename');\n await rm(stage, { recursive: true, force: true });\n } catch (error) {\n await restore();\n throw error;\n }\n const report: V2ImportReport = {\n reportId: id,\n status: 'applied',\n bundleRoot: plan.bundleRoot,\n projectRoot: plan.projectRoot,\n backupRoot,\n sourceDigest: plan.sourceDigest,\n targetDigest: plan.targetDigest,\n files: plan.files.filter((file) => file.action !== 'keep').map((file) => file.path),\n warnings: plan.warnings,\n createdAt: options.now ?? new Date().toISOString(),\n };\n try {\n options.fault?.('before-report');\n await mkdir(dirname(reportPath), { recursive: true, mode: 0o700 });\n await writeFile(reportPath, `${JSON.stringify({ ...report, existing }, null, 2)}\\n`, { mode: 0o600 });\n } catch (error) {\n await restore();\n throw error;\n }\n return report;\n}\n\nexport async function rollbackV2Import(report: V2ImportReport): Promise<V2ImportReport> {\n for (const path of report.files) {\n const backup = join(report.backupRoot, path);\n try {\n await stat(backup);\n await mkdir(dirname(join(report.projectRoot, path)), { recursive: true, mode: 0o700 });\n await cp(backup, join(report.projectRoot, path), { recursive: true, verbatimSymlinks: true });\n } catch {\n await rm(join(report.projectRoot, path), { recursive: true, force: true });\n }\n }\n return { ...report, status: 'rolled-back' };\n}\n\nexport function projectModelFromV2(bundle: V2ExportResult, model: ProjectModel): string {\n return stringify({\n ...model,\n provenance: { ...model.provenance, toolVersion: `v2-import:${bundle.manifest.sourceVersion ?? 'unknown'}` },\n });\n}\n","import { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { sha256Hex } from '@cohorte/base';\nimport { stringify } from 'yaml';\nimport type { InitPlan, ProjectModel } from '../contract.ts';\n\nexport interface PlanInitOptions {\n root: string;\n model: ProjectModel;\n cohorteVersion: string;\n /** refused in V3.0: `configuration/phase-not-available` */\n semantic?: boolean;\n}\n\nexport async function planInit(options: PlanInitOptions): Promise<InitPlan> {\n if (options.semantic) throw new Error('configuration/phase-not-available: semantic init is not available in V3.0');\n const root = options.root;\n const modelYaml = stringify(options.model);\n const files = [\n { path: 'project.yaml', class: 'generated' as const, content: modelYaml, templateId: 'project-model/v1' },\n { path: 'config.yaml', class: 'human' as const, content: 'schemaVersion: 1\\n' },\n { path: 'ownership.yaml', class: 'human' as const, content: 'surfaces: {}\\n' },\n {\n path: '.gitignore',\n class: 'generated' as const,\n content: 'state/\\nruns/\\n',\n templateId: 'cohorte/gitignore/v1',\n },\n {\n path: 'generated/.gitkeep',\n class: 'generated' as const,\n content: '',\n templateId: 'cohorte/generated-dir/v1',\n },\n ];\n const initFiles: InitPlan['files'] = [];\n for (const file of files) {\n let exists = false;\n try {\n await readFile(join(root, '.cohorte', file.path));\n exists = true;\n } catch {\n /* create */\n }\n const renderedSha256 = sha256Hex(file.content);\n initFiles.push({\n path: file.path,\n action: exists ? 'keep-existing' : 'create',\n class: file.class,\n content: file.content,\n ...(file.templateId === undefined ? {} : { templateId: file.templateId }),\n ...(file.class === 'generated' ? { templateSha256: renderedSha256, renderedSha256 } : {}),\n });\n }\n const generated = initFiles\n .filter((file) => file.class === 'generated')\n .map((file) => ({\n path: file.path,\n templateId: file.templateId ?? 'builtin',\n templateSha256: file.templateSha256 ?? sha256Hex(file.content),\n renderedSha256: file.renderedSha256 ?? sha256Hex(file.content),\n }));\n return {\n projectRoot: root,\n model: options.model,\n files: initFiles,\n manifest: {\n schemaVersion: 1,\n cohorteVersion: options.cohorteVersion,\n createdWith: options.cohorteVersion,\n protocol: { min: '3.0', max: '3.x' },\n stateSchemaVersion: 1,\n generated,\n },\n warnings: [],\n };\n}\n\nexport async function applyInit(plan: InitPlan): Promise<{ written: string[]; kept: string[] }> {\n await mkdir(join(plan.projectRoot, '.cohorte'), { recursive: true, mode: 0o700 });\n const written: string[] = [];\n const kept: string[] = [];\n for (const file of plan.files) {\n const target = join(plan.projectRoot, '.cohorte', file.path);\n if (file.action === 'keep-existing') {\n kept.push(file.path);\n continue;\n }\n await mkdir(join(target, '..'), { recursive: true, mode: 0o700 });\n await writeFile(target, file.content, { mode: 0o600 });\n written.push(file.path);\n }\n const manifestPath = join(plan.projectRoot, '.cohorte', 'manifest.yaml');\n try {\n await readFile(manifestPath);\n kept.push('manifest.yaml');\n } catch {\n await writeFile(manifestPath, stringify(plan.manifest), { mode: 0o600 });\n written.push('manifest.yaml');\n }\n return { written, kept };\n}\n","import { appendFile, copyFile, mkdir, readFile, unlink, writeFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport { type Clock, sha256Hex } from '@cohorte/base';\nimport { DEFAULT_CONFIG } from '@cohorte/config/schema';\nimport { parse } from 'yaml';\nimport type { DesiredState, ReconcilePlan, RepositoryScanner } from '../contract.ts';\nimport { deriveDesiredState } from '../desired/index.ts';\nimport { diffStates, readActualState } from '../drift/index.ts';\n\nexport interface PlanReconcileOptions {\n root: string;\n /** injected: this area never imports the scan area */\n scan: RepositoryScanner;\n cohorteVersion: string;\n clock: Clock;\n}\n\nexport interface ApplyReconcileOptions {\n root: string;\n plan: ReconcilePlan;\n desired: DesiredState;\n backup?: boolean;\n clock: Clock;\n}\n\n/** READ-ONLY. */\nexport async function planReconcile(options: PlanReconcileOptions): Promise<ReconcilePlan> {\n const model = await options.scan(options.root);\n // `provenance.generatedAt` is metadata, not project content. Reuse the\n // previous generated timestamp so a read-only reconcile is stable; changed\n // model fields still alter the rendered project and manifest hashes.\n let stableModel = model;\n try {\n const actual = parse(await readFile(join(options.root, '.cohorte', 'project.yaml'), 'utf8')) as {\n provenance?: { generatedAt?: unknown };\n };\n const generatedAt = actual.provenance?.generatedAt;\n const stableGeneratedAt =\n generatedAt instanceof Date\n ? generatedAt.toISOString()\n : typeof generatedAt === 'string'\n ? generatedAt\n : undefined;\n if (stableGeneratedAt !== undefined) {\n stableModel = {\n ...model,\n provenance: {\n ...model.provenance,\n generatedAt: stableGeneratedAt as typeof model.provenance.generatedAt,\n },\n };\n }\n } catch {\n /* an uninitialised or malformed project is represented by the normal drift entries */\n }\n const desired = deriveDesiredState({\n model: stableModel,\n config: DEFAULT_CONFIG,\n cohorteVersion: options.cohorteVersion,\n skills: {},\n });\n const actual = await readActualState(options.root);\n const drift = diffStates(desired, actual, options.clock);\n const operations = drift.entries.map((entry) => {\n const op =\n entry.diff === 'absent'\n ? 'create'\n : entry.diff === 'expected-change'\n ? 'replace'\n : entry.diff === 'potential-deletion'\n ? 'delete'\n : entry.diff === 'unknown'\n ? 'keep'\n : 'ask';\n return { op, target: entry.target, diff: entry.diff, reason: entry.detail } as const;\n });\n return {\n schemaVersion: 1,\n cohorteVersion: options.cohorteVersion,\n generatedAt: drift.generatedAt,\n drift,\n operations,\n conflicts: drift.entries.filter((entry) => entry.diff === 'conflict').map((entry) => entry.target),\n applyAvailable: true,\n };\n}\n\n/** Apply only create/replace/delete operations authorized by a conflict-free plan. */\nexport async function applyReconcile(options: ApplyReconcileOptions): Promise<{\n applied: string[];\n skipped: string[];\n backupDir?: string;\n journal: string;\n}> {\n if (options.plan.conflicts.length > 0)\n throw new Error(`conflict/reconcile-human-edit: ${options.plan.conflicts.join(', ')}`);\n const desiredByPath = new Map(options.desired.files.map((file) => [file.path, file]));\n const backupDir = options.backup\n ? join(options.root, '.cohorte', 'reconcile-backups', options.clock.now().replaceAll(':', ''))\n : undefined;\n const journal = join(options.root, '.cohorte', 'reconcile.log');\n await mkdir(join(options.root, '.cohorte'), { recursive: true, mode: 0o700 });\n const applied: string[] = [];\n const skipped: string[] = [];\n for (const operation of options.plan.operations) {\n if (operation.op !== 'create' && operation.op !== 'replace' && operation.op !== 'delete') {\n skipped.push(operation.target);\n continue;\n }\n const target = join(options.root, '.cohorte', operation.target);\n if (!target.startsWith(`${join(options.root, '.cohorte')}/`)) throw new Error('security/path-outside-grant');\n const existing = await readFile(target).catch(() => undefined);\n const drift = options.plan.drift.entries.find((entry) => entry.target === operation.target);\n const actualSha256 = existing === undefined ? undefined : sha256Hex(existing);\n if (actualSha256 !== drift?.actualSha256)\n throw new Error(`conflict/reconcile-race: ${operation.target} changed after the plan was generated`);\n if (existing !== undefined && backupDir) {\n const backupPath = join(backupDir, operation.target);\n await mkdir(dirname(backupPath), { recursive: true });\n await copyFile(target, backupPath);\n }\n if (operation.op === 'delete') await unlink(target).catch(() => undefined);\n else {\n const file = desiredByPath.get(operation.target);\n if (file?.content === undefined) throw new Error(`configuration/reconcile-content-missing: ${operation.target}`);\n await mkdir(dirname(target), { recursive: true });\n await writeFile(target, file.content, 'utf8');\n }\n applied.push(operation.target);\n await appendFile(\n journal,\n `${JSON.stringify({ at: options.clock.now(), op: operation.op, target: operation.target })}\\n`,\n );\n }\n return { applied, skipped, ...(backupDir ? { backupDir } : {}), journal };\n}\n"],"mappings":";;;;;;;;;AAaA,SAAgB,mBAAmB,OAAwC;CACzE,MAAM,YAAY,UAAU,MAAM,KAAK;CACvC,MAAM,qCAAqB,IAAI,IAAoB;CACnD,KAAK,MAAM,QAAQ,MAAM,MAAM,mBAAmB,OAAO;EACvD,MAAM,WAAW,KAAK,QAAQ,iBAAiB,EAAE;EACjD,IAAI,aAAa,mBAAmB,aAAa,gBAAgB;EACjE,mBAAmB,IACjB,UACA,cAAc;GACZ,MAAM;GACN,OAAO,MAAM;GACb,QAAQ,MAAM;GACd,QAAQ,MAAM;EAChB,CAAyB,CAC3B;CACF;CACA,MAAM,WAAW;EACf,eAAe;EACf,gBAAgB,MAAM;EACtB,aAAa,MAAM;EACnB,UAAU;GAAE,KAAK;GAAO,KAAK;EAAM;EACnC,oBAAoB;EACpB,WAAW;GACT;IACE,MAAM;IACN,YAAY;IACZ,gBAAgB,UAAU,SAAS;IACnC,gBAAgB,UAAU,SAAS;GACrC;GACA;IACE,MAAM;IACN,YAAY;IACZ,gBAAgB,UAAU,iBAAiB;IAC3C,gBAAgB,UAAU,iBAAiB;GAC7C;GACA;IACE,MAAM;IACN,YAAY;I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,MAAM,SAAS,MAAM,CAAC,CAAC,YAAY,KAAA,CAAS;EAC7D,MAAM,QAAQ,QAAQ,KAAK,MAAM,QAAQ,MAAM,UAAU,MAAM,WAAW,UAAU,MAAM;EAE1F,KADqB,aAAa,KAAA,IAAY,KAAA,IAAY,UAAU,QAAQ,OACvD,OAAO,cAC1B,MAAM,IAAI,MAAM,4BAA4B,UAAU,OAAO,sCAAsC;EACrG,IAAI,aAAa,KAAA,KAAa,WAAW;GACvC,MAAM,aAAa,KAAK,WAAW,UAAU,MAAM;GACnD,MAAM,MAAM,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;GACpD,MAAM,SAAS,QAAQ,UAAU;EACnC;EACA,IAAI,UAAU,OAAO,UAAU,MAAM,OAAO,MAAM,CAAC,CAAC,YAAY,KAAA,CAAS;OACpE;GACH,MAAM,OAAO,cAAc,IAAI,UAAU,MAAM;GAC/C,IAAI,MAAM,YAAY,KAAA,GAAW,MAAM,IAAI,MAAM,4CAA4C,UAAU,QAAQ;GAC/G,MAAM,MAAM,QAAQ,MAAM,GAAG,EAAE,WAAW,KAAK,CAAC;GAChD,MAAM,UAAU,QAAQ,KAAK,SAAS,MAAM;EAC9C;EACA,QAAQ,KAAK,UAAU,MAAM;EAC7B,MAAM,WACJ,SACA,GAAG,KAAK,UAAU;GAAE,IAAI,QAAQ,MAAM,IAAI;GAAG,IAAI,UAAU;GAAI,QAAQ,UAAU;EAAO,CAAC,EAAE,GAC7F;CACF;CACA,OAAO;EAAE;EAAS;EAAS,GAAI,YAAY,EAAE,UAAU,IAAI,CAAC;EAAI;CAAQ;AAC1E"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { F as EXIT_CODE_BY_CLASS, P as toErrorInfo } from "./chunks/src-Cu3TxNob.mjs";
|
|
3
|
-
import { n as formatExitCodesHelp, t as VERBS } from "./chunks/contract-
|
|
3
|
+
import { n as formatExitCodesHelp, t as VERBS } from "./chunks/contract-BkMjU1kR.mjs";
|
|
4
4
|
import { r as CONTROLLER_EXIT_CODES } from "./chunks/src-s7YRvk0t.mjs";
|
|
5
5
|
import { Command, CommanderError } from "commander";
|
|
6
6
|
//#region src/lazy.ts
|
|
@@ -13,9 +13,9 @@ import { Command, CommanderError } from "commander";
|
|
|
13
13
|
* registry without a loader — or the reverse — fails Wave 0's own check.
|
|
14
14
|
*/
|
|
15
15
|
const COMMAND_MODULES = Object.freeze({
|
|
16
|
-
init: () => import("./chunks/init-
|
|
17
|
-
doctor: () => import("./chunks/doctor-
|
|
18
|
-
discover: () => import("./chunks/discover-
|
|
16
|
+
init: () => import("./chunks/init-BUnzIkeE.mjs"),
|
|
17
|
+
doctor: () => import("./chunks/doctor-B-H2UK5e.mjs"),
|
|
18
|
+
discover: () => import("./chunks/discover-eS01-me1.mjs"),
|
|
19
19
|
run: () => import("./chunks/run-CgTWYlcd.mjs"),
|
|
20
20
|
status: () => import("./chunks/status-SMjiOMYy.mjs"),
|
|
21
21
|
inspect: () => import("./chunks/inspect-Buby4cQD.mjs"),
|
|
@@ -33,17 +33,17 @@ const COMMAND_MODULES = Object.freeze({
|
|
|
33
33
|
review: () => import("./chunks/review-BDdjb6kB.mjs"),
|
|
34
34
|
fix: () => import("./chunks/fix-D4Tj8RVA.mjs"),
|
|
35
35
|
ship: () => import("./chunks/ship-DTuLGoaJ.mjs"),
|
|
36
|
-
auth: () => import("./chunks/auth-
|
|
36
|
+
auth: () => import("./chunks/auth-CYOh60KG.mjs"),
|
|
37
37
|
providers: () => import("./chunks/providers-Dx78imKj.mjs"),
|
|
38
38
|
models: () => import("./chunks/models-Btp6X2YZ.mjs"),
|
|
39
39
|
config: () => import("./chunks/config-DefHA2Lw.mjs"),
|
|
40
|
-
migrate: () => import("./chunks/migrate-
|
|
41
|
-
reconcile: () => import("./chunks/reconcile-
|
|
40
|
+
migrate: () => import("./chunks/migrate-DybihKzZ.mjs"),
|
|
41
|
+
reconcile: () => import("./chunks/reconcile-Bhy3IIYo.mjs"),
|
|
42
42
|
spec: () => import("./chunks/spec-Bq0P3jVh.mjs"),
|
|
43
43
|
policy: () => import("./chunks/policy-DUIgzF3W.mjs"),
|
|
44
44
|
gc: () => import("./chunks/gc-BBXlBF5w.mjs"),
|
|
45
45
|
update: () => import("./chunks/update-BXIppsbi.mjs"),
|
|
46
|
-
brainstorm: () => import("./chunks/brainstorm-
|
|
46
|
+
brainstorm: () => import("./chunks/brainstorm-BwKA6yZP.mjs"),
|
|
47
47
|
"run-tool": () => import("./chunks/run-tool-C3rAv4XF.mjs"),
|
|
48
48
|
send: () => import("./chunks/send-BdnJ85Nz.mjs"),
|
|
49
49
|
__host: () => import("./chunks/__host-DgGPyco9.mjs")
|
|
@@ -61,7 +61,7 @@ async function loadCommandModule(verb) {
|
|
|
61
61
|
* only through here, so a read-only verb whose action never runs never pays for it either (DESIGN 1.3).
|
|
62
62
|
*/
|
|
63
63
|
async function loadCliContext(inputs) {
|
|
64
|
-
const mod = await import("./chunks/compose-
|
|
64
|
+
const mod = await import("./chunks/compose-Dvxunpto.mjs");
|
|
65
65
|
if (typeof mod.composeCliContext !== "function") throw new TypeError("lazy.ts: compose/index.ts has no composeCliContext export");
|
|
66
66
|
return mod.composeCliContext(inputs);
|
|
67
67
|
}
|
|
@@ -69,7 +69,7 @@ async function loadCliContext(inputs) {
|
|
|
69
69
|
//#region src/cli.ts
|
|
70
70
|
/** Mirrors `apps/cli/package.json` "version"; `apps/cli/test/registry/version.test.ts` reads that file and fails
|
|
71
71
|
* if the two ever drift (a literal keeps `--version` free of any file read on the one-shot start-up path). */
|
|
72
|
-
const COHORTE_VERSION = "3.0.0-dev.
|
|
72
|
+
const COHORTE_VERSION = "3.0.0-dev.1";
|
|
73
73
|
function printError(deps, info) {
|
|
74
74
|
deps.stderr.write(`error: ${info.code}: ${info.message}\n`);
|
|
75
75
|
deps.stderr.write(`impact: ${info.impact}\n`);
|
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":[],"sources":["../../../apps/cli/src/lazy.ts","../../../apps/cli/src/cli.ts"],"sourcesContent":["// apps/cli/src/lazy.ts — the ONLY `import(` site of `apps/cli/src` (DESIGN 1.2 net 3 rule g, DESIGN 1.3, DESIGN\n// 6.3 §\"read-only verbs never load core/runtime\"). `check-layers` refuses `import(` anywhere else under\n// `apps/cli/src/**` (rule g is per FILE, not per occurrence), so a verb module that needs `compose`/`host`/etc.\n// reaches them only through here, which keeps `cli.ts` (and every module reachable from it without going through\n// `lazy.ts`) inside François' 10 s / 4 MiB one-shot budget for a verb that never needs the heavy ports.\nimport type { CliContext, CommandModule } from './contract/index.ts';\n\n/** What `compose/index.ts` (U4.01) exports: assembles the real `CliContext` from process-level inputs. */\nexport interface ComposeInputs {\n readonly cwd: string;\n readonly env: NodeJS.ProcessEnv;\n readonly stdio: {\n readonly stdout: NodeJS.WritableStream;\n readonly stderr: NodeJS.WritableStream;\n readonly stdin: NodeJS.ReadableStream;\n };\n}\n\n/**\n * One LITERAL specifier per verb, closed over a thunk. A computed specifier (`` import(`./commands/${verb}/…`) ``)\n * is invisible to every bundler: rolldown would leave the template in `dist/cli.mjs` and emit no verb chunk, so the\n * SHIPPED cli could not execute a single verb (it would try to load a `.ts` file next to `dist/`). Written out, each\n * specifier is statically analysable: rolldown code-splits one chunk per verb, laziness is preserved, and\n * `apps/cli/test/registry/lazy.test.ts` pins this map against `VERBS` in both directions so a verb added to the\n * registry without a loader — or the reverse — fails Wave 0's own check.\n */\nexport const COMMAND_MODULES: Readonly<Record<string, () => Promise<unknown>>> = Object.freeze({\n init: () => import('./commands/init/index.ts'),\n doctor: () => import('./commands/doctor/index.ts'),\n discover: () => import('./commands/discover/index.ts'),\n run: () => import('./commands/run/index.ts'),\n status: () => import('./commands/status/index.ts'),\n inspect: () => import('./commands/inspect/index.ts'),\n resume: () => import('./commands/resume/index.ts'),\n pause: () => import('./commands/pause/index.ts'),\n cancel: () => import('./commands/cancel/index.ts'),\n shutdown: () => import('./commands/shutdown/index.ts'),\n approve: () => import('./commands/approve/index.ts'),\n deny: () => import('./commands/deny/index.ts'),\n retry: () => import('./commands/retry/index.ts'),\n skip: () => import('./commands/skip/index.ts'),\n logs: () => import('./commands/logs/index.ts'),\n tail: () => import('./commands/tail/index.ts'),\n diff: () => import('./commands/diff/index.ts'),\n review: () => import('./commands/review/index.ts'),\n fix: () => import('./commands/fix/index.ts'),\n ship: () => import('./commands/ship/index.ts'),\n auth: () => import('./commands/auth/index.ts'),\n providers: () => import('./commands/providers/index.ts'),\n models: () => import('./commands/models/index.ts'),\n config: () => import('./commands/config/index.ts'),\n migrate: () => import('./commands/migrate/index.ts'),\n reconcile: () => import('./commands/reconcile/index.ts'),\n spec: () => import('./commands/spec/index.ts'),\n policy: () => import('./commands/policy/index.ts'),\n gc: () => import('./commands/gc/index.ts'),\n update: () => import('./commands/update/index.ts'),\n brainstorm: () => import('./commands/brainstorm/index.ts'),\n 'run-tool': () => import('./commands/run-tool/index.ts'),\n send: () => import('./commands/send/index.ts'),\n __host: () => import('./commands/__host/index.ts'),\n});\n\n/** Loads `commands/<verb>/index.ts` and returns its default export. */\nexport async function loadCommandModule(verb: string): Promise<CommandModule> {\n const load = COMMAND_MODULES[verb];\n if (!load) throw new RangeError(`lazy.ts: no command module registered for verb \"${verb}\"`);\n const loaded = await load();\n const mod = loaded as { default?: CommandModule };\n if (!mod.default || typeof mod.default.run !== 'function') {\n throw new TypeError(`lazy.ts: commands/${verb}/index.ts has no default CommandModule export`);\n }\n return mod.default;\n}\n\n/**\n * The one `import(` of `./compose/index.ts` (DESIGN 1.2 net 3 rule g): `cli.ts` reaches the real `CliContext`\n * only through here, so a read-only verb whose action never runs never pays for it either (DESIGN 1.3).\n */\nexport async function loadCliContext(inputs: ComposeInputs): Promise<CliContext> {\n const loaded: unknown = await import('./compose/index.ts');\n const mod = loaded as { composeCliContext?: (inputs: ComposeInputs) => Promise<CliContext> };\n if (typeof mod.composeCliContext !== 'function') {\n throw new TypeError('lazy.ts: compose/index.ts has no composeCliContext export');\n }\n return mod.composeCliContext(inputs);\n}\n","#!/usr/bin/env node\n// apps/cli/src/cli.ts — DESIGN §9 CLI row: the whole verb registry, built from `contract/verbs.ts` and nothing\n// else (PLAN §3 rule 3 \"cli.ts pre-registers every verb against commands/<verb>/index.ts; ... nobody edits the\n// registry\"). `cli.ts` never imports `core`/`runtime-*`/`security`/`persistence` directly: a verb's module, and the\n// real `CliContext`, are reached only through `lazy.ts`'s single `import()` site (DESIGN 1.2 net 3 rule g, DESIGN\n// 1.3 \"read-only verbs never load core/runtime\") — so `--help` and `--version`, which commander answers itself\n// without ever calling `dispatch`, pay nothing beyond this file and `commander`.\nimport { toErrorInfo } from '@cohorte/base';\nimport { Command, CommanderError } from 'commander';\nimport {\n type CliContext,\n CONTROLLER_EXIT_CODES,\n type CommandArgs,\n EXIT_CODE_BY_CLASS,\n formatExitCodesHelp,\n VERBS,\n type VerbSpec,\n} from './contract/index.ts';\nimport { loadCliContext, loadCommandModule } from './lazy.ts';\n\n/** Mirrors `apps/cli/package.json` \"version\"; `apps/cli/test/registry/version.test.ts` reads that file and fails\n * if the two ever drift (a literal keeps `--version` free of any file read on the one-shot start-up path). */\nexport const COHORTE_VERSION = '3.0.0-dev.0';\n\nexport interface RuntimeDeps {\n readonly stdout: NodeJS.WritableStream;\n readonly stderr: NodeJS.WritableStream;\n /** Built lazily: only a verb whose action actually runs calls this (never `--help`/`--version`, DESIGN 1.3). */\n readonly context: () => Promise<CliContext>;\n}\n\nfunction printError(deps: RuntimeDeps, info: ReturnType<typeof toErrorInfo>): void {\n // spec 21: \"cause / impact / run / next action / exit code\"\n deps.stderr.write(`error: ${info.code}: ${info.message}\\n`);\n deps.stderr.write(`impact: ${info.impact}\\n`);\n deps.stderr.write(`next action: ${info.remediation}\\n`);\n}\n\n/** Loads the verb's module, builds its `CliContext` and runs it, converting any throw at this one boundary\n * (DESIGN 2.8: \"Every error has ... an exit code\"; the module itself never writes to stdio on error). */\nasync function dispatch(deps: RuntimeDeps, verb: string, args: CommandArgs): Promise<number> {\n try {\n const mod = await loadCommandModule(verb);\n const ctx = await deps.context();\n return await mod.run(ctx, args);\n } catch (error) {\n // DESIGN 2.8: \"Unknown throwables -> `<nearest class>/unexpected`\". A `CohorteError` keeps its own code through\n // `toErrorInfo`, so the Wave-0 stubs still answer `configuration/phase-not-available`; anything else — a\n // TypeError in a filled-in verb, a failed store open, a module that will not load — is reported as what it is.\n const info = toErrorInfo(error, { code: 'configuration/unexpected', class: 'configuration' });\n printError(deps, info);\n return EXIT_CODE_BY_CLASS[info.class];\n }\n}\n\ninterface ExitBox {\n code: number;\n}\n\nfunction addAction(command: Command, deps: RuntimeDeps, exit: ExitBox, verb: VerbSpec, subVerb?: string): void {\n command.allowUnknownOption(true).allowExcessArguments(true);\n // `--json` only where DESIGN 2.3.5 gives the verb a published document (`JSON_OUTPUTS`): registering it on every\n // verb would promise a machine output that no schema backs, and the Wave-4 `--json validates` tests read that map.\n if (verb.json) command.option('--json', 'print the machine-readable document for this verb (DESIGN 2.3.5)');\n command.argument('[args...]', 'verb arguments').action(async (positionals: string[], options: { json?: boolean }) => {\n const args: CommandArgs = {\n positionals,\n options,\n json: Boolean(options.json),\n ...(subVerb === undefined ? {} : { subVerb }),\n };\n exit.code = await dispatch(deps, verb.name, args);\n });\n}\n\n/** Builds the whole commander tree. Exported so a test can assert on `--help` / registration without spawning a\n * process (PLAN U0.10 test list: \"every DESIGN §9 verb is registered exactly once and appears in --help\"). */\nexport function buildProgram(deps: RuntimeDeps, exit: ExitBox): Command {\n const program = new Command('cohorte')\n .description('Cohorte: a durable multi-agent development pipeline with a runtime-independent orchestrator.')\n .version(COHORTE_VERSION, '--version', 'print the Cohorte version')\n .exitOverride()\n .configureOutput({\n writeOut: (str) => deps.stdout.write(str),\n writeErr: (str) => deps.stderr.write(str),\n })\n .addHelpText('after', `\\n${formatExitCodesHelp()}\\n`);\n\n for (const verb of VERBS) {\n const sub = program.command(verb.name, verb.hidden ? { hidden: true } : undefined).description(verb.summary);\n if (verb.subVerbs && verb.subVerbs.length > 0) {\n addAction(sub, deps, exit, verb); // bare `cohorte <verb>` with no sub-verb\n for (const subVerb of verb.subVerbs) {\n addAction(sub.command(subVerb), deps, exit, verb, subVerb);\n }\n } else {\n addAction(sub, deps, exit, verb);\n }\n }\n return program;\n}\n\n/**\n * `CONTROLLER_EXIT_CODES.usage` (2) for anything commander itself refuses (bad flag, unknown command, no command at\n * all), `completed` (0) for the routes where commander did exactly what was asked and then stopped the parse.\n *\n * Keyed off commander's OWN `exitCode`, not off the code NAME: commander raises `commander.help` both for the\n * advertised `help [command]` route (which prints the help and means exit 0) and for a bare `cohorte` with no\n * command (exit 1 there — a usage error), and an allow-list of names got the first case wrong while `--help`,\n * raising `commander.helpDisplayed`, was right. `error.exitCode` already separates the two.\n */\nfunction commanderExitCode(error: CommanderError): number {\n return error.exitCode === 0 ? CONTROLLER_EXIT_CODES.completed : CONTROLLER_EXIT_CODES.usage;\n}\n\n/** Parses `argv` (no leading node/script entries) and runs the matched verb. Never calls `process.exit`: the\n * caller (`main()` below, or a test) owns that decision. */\nexport async function runCli(argv: readonly string[], deps: RuntimeDeps): Promise<number> {\n const exit: ExitBox = { code: CONTROLLER_EXIT_CODES.completed };\n const program = buildProgram(deps, exit);\n try {\n await program.parseAsync(argv, { from: 'user' });\n } catch (error) {\n if (error instanceof CommanderError) return commanderExitCode(error);\n throw error;\n }\n return exit.code;\n}\n\nasync function realContext(): Promise<CliContext> {\n return loadCliContext({\n cwd: process.cwd(),\n env: process.env,\n stdio: { stdout: process.stdout, stderr: process.stderr, stdin: process.stdin },\n });\n}\n\nasync function main(): Promise<void> {\n const deps: RuntimeDeps = { stdout: process.stdout, stderr: process.stderr, context: realContext };\n const code = await runCli(process.argv.slice(2), deps);\n process.exitCode = code;\n}\n\n// `import.meta.main` (node >= 24.2; `apps/cli` engines are `^24.16.0 || >=26.1.0`) and NOT a hand-rolled\n// `import.meta.url === \\`file://${process.argv[1]}\\``: npm installs `bin` as a SYMLINK\n// (`node_modules/.bin/cohorte` -> `../cohorte/dist/cli.mjs`), so the comparison is false for every real install and\n// the published CLI would print nothing and exit 0. It also breaks on any install path with a space or a non-ASCII\n// character (`import.meta.url` is percent-encoded, `argv[1]` is not).\nif (import.meta.main) {\n main().catch((error: unknown) => {\n process.stderr.write(`fatal: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}\\n`);\n process.exitCode = 1;\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BA,MAAa,kBAAoE,OAAO,OAAO;CAC7F,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,gBAAgB,OAAO;CACvB,WAAW,OAAO;CAClB,cAAc,OAAO;CACrB,eAAe,OAAO;CACtB,cAAc,OAAO;CACrB,aAAa,OAAO;CACpB,cAAc,OAAO;CACrB,gBAAgB,OAAO;CACvB,eAAe,OAAO;CACtB,YAAY,OAAO;CACnB,aAAa,OAAO;CACpB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,WAAW,OAAO;CAClB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,iBAAiB,OAAO;CACxB,cAAc,OAAO;CACrB,cAAc,OAAO;CACrB,eAAe,OAAO;CACtB,iBAAiB,OAAO;CACxB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,UAAU,OAAO;CACjB,cAAc,OAAO;CACrB,kBAAkB,OAAO;CACzB,kBAAkB,OAAO;CACzB,YAAY,OAAO;CACnB,cAAc,OAAO;AACvB,CAAC;;AAGD,eAAsB,kBAAkB,MAAsC;CAC5E,MAAM,OAAO,gBAAgB;CAC7B,IAAI,CAAC,MAAM,MAAM,IAAI,WAAW,mDAAmD,KAAK,EAAE;CAE1F,MAAM,MAAM,MADS,KAAK;CAE1B,IAAI,CAAC,IAAI,WAAW,OAAO,IAAI,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Q;GAAQ,QAAQ,QAAQ;GAAQ,OAAO,QAAQ;EAAM;CAChF,CAAC;AACH;AAEA,eAAe,OAAsB;CACnC,MAAM,OAAoB;EAAE,QAAQ,QAAQ;EAAQ,QAAQ,QAAQ;EAAQ,SAAS;CAAY;CACjG,MAAM,OAAO,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC,GAAG,IAAI;CACrD,QAAQ,WAAW;AACrB;AAOA,IAAI,YAAY,MACd,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,OAAO,MAAM,UAAU,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK,EAAE,GAAG;CAC1G,QAAQ,WAAW;AACrB,CAAC"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../../../apps/cli/src/lazy.ts","../../../apps/cli/src/cli.ts"],"sourcesContent":["// apps/cli/src/lazy.ts — the ONLY `import(` site of `apps/cli/src` (DESIGN 1.2 net 3 rule g, DESIGN 1.3, DESIGN\n// 6.3 §\"read-only verbs never load core/runtime\"). `check-layers` refuses `import(` anywhere else under\n// `apps/cli/src/**` (rule g is per FILE, not per occurrence), so a verb module that needs `compose`/`host`/etc.\n// reaches them only through here, which keeps `cli.ts` (and every module reachable from it without going through\n// `lazy.ts`) inside François' 10 s / 4 MiB one-shot budget for a verb that never needs the heavy ports.\nimport type { CliContext, CommandModule } from './contract/index.ts';\n\n/** What `compose/index.ts` (U4.01) exports: assembles the real `CliContext` from process-level inputs. */\nexport interface ComposeInputs {\n readonly cwd: string;\n readonly env: NodeJS.ProcessEnv;\n readonly stdio: {\n readonly stdout: NodeJS.WritableStream;\n readonly stderr: NodeJS.WritableStream;\n readonly stdin: NodeJS.ReadableStream;\n };\n}\n\n/**\n * One LITERAL specifier per verb, closed over a thunk. A computed specifier (`` import(`./commands/${verb}/…`) ``)\n * is invisible to every bundler: rolldown would leave the template in `dist/cli.mjs` and emit no verb chunk, so the\n * SHIPPED cli could not execute a single verb (it would try to load a `.ts` file next to `dist/`). Written out, each\n * specifier is statically analysable: rolldown code-splits one chunk per verb, laziness is preserved, and\n * `apps/cli/test/registry/lazy.test.ts` pins this map against `VERBS` in both directions so a verb added to the\n * registry without a loader — or the reverse — fails Wave 0's own check.\n */\nexport const COMMAND_MODULES: Readonly<Record<string, () => Promise<unknown>>> = Object.freeze({\n init: () => import('./commands/init/index.ts'),\n doctor: () => import('./commands/doctor/index.ts'),\n discover: () => import('./commands/discover/index.ts'),\n run: () => import('./commands/run/index.ts'),\n status: () => import('./commands/status/index.ts'),\n inspect: () => import('./commands/inspect/index.ts'),\n resume: () => import('./commands/resume/index.ts'),\n pause: () => import('./commands/pause/index.ts'),\n cancel: () => import('./commands/cancel/index.ts'),\n shutdown: () => import('./commands/shutdown/index.ts'),\n approve: () => import('./commands/approve/index.ts'),\n deny: () => import('./commands/deny/index.ts'),\n retry: () => import('./commands/retry/index.ts'),\n skip: () => import('./commands/skip/index.ts'),\n logs: () => import('./commands/logs/index.ts'),\n tail: () => import('./commands/tail/index.ts'),\n diff: () => import('./commands/diff/index.ts'),\n review: () => import('./commands/review/index.ts'),\n fix: () => import('./commands/fix/index.ts'),\n ship: () => import('./commands/ship/index.ts'),\n auth: () => import('./commands/auth/index.ts'),\n providers: () => import('./commands/providers/index.ts'),\n models: () => import('./commands/models/index.ts'),\n config: () => import('./commands/config/index.ts'),\n migrate: () => import('./commands/migrate/index.ts'),\n reconcile: () => import('./commands/reconcile/index.ts'),\n spec: () => import('./commands/spec/index.ts'),\n policy: () => import('./commands/policy/index.ts'),\n gc: () => import('./commands/gc/index.ts'),\n update: () => import('./commands/update/index.ts'),\n brainstorm: () => import('./commands/brainstorm/index.ts'),\n 'run-tool': () => import('./commands/run-tool/index.ts'),\n send: () => import('./commands/send/index.ts'),\n __host: () => import('./commands/__host/index.ts'),\n});\n\n/** Loads `commands/<verb>/index.ts` and returns its default export. */\nexport async function loadCommandModule(verb: string): Promise<CommandModule> {\n const load = COMMAND_MODULES[verb];\n if (!load) throw new RangeError(`lazy.ts: no command module registered for verb \"${verb}\"`);\n const loaded = await load();\n const mod = loaded as { default?: CommandModule };\n if (!mod.default || typeof mod.default.run !== 'function') {\n throw new TypeError(`lazy.ts: commands/${verb}/index.ts has no default CommandModule export`);\n }\n return mod.default;\n}\n\n/**\n * The one `import(` of `./compose/index.ts` (DESIGN 1.2 net 3 rule g): `cli.ts` reaches the real `CliContext`\n * only through here, so a read-only verb whose action never runs never pays for it either (DESIGN 1.3).\n */\nexport async function loadCliContext(inputs: ComposeInputs): Promise<CliContext> {\n const loaded: unknown = await import('./compose/index.ts');\n const mod = loaded as { composeCliContext?: (inputs: ComposeInputs) => Promise<CliContext> };\n if (typeof mod.composeCliContext !== 'function') {\n throw new TypeError('lazy.ts: compose/index.ts has no composeCliContext export');\n }\n return mod.composeCliContext(inputs);\n}\n","#!/usr/bin/env node\n// apps/cli/src/cli.ts — DESIGN §9 CLI row: the whole verb registry, built from `contract/verbs.ts` and nothing\n// else (PLAN §3 rule 3 \"cli.ts pre-registers every verb against commands/<verb>/index.ts; ... nobody edits the\n// registry\"). `cli.ts` never imports `core`/`runtime-*`/`security`/`persistence` directly: a verb's module, and the\n// real `CliContext`, are reached only through `lazy.ts`'s single `import()` site (DESIGN 1.2 net 3 rule g, DESIGN\n// 1.3 \"read-only verbs never load core/runtime\") — so `--help` and `--version`, which commander answers itself\n// without ever calling `dispatch`, pay nothing beyond this file and `commander`.\nimport { toErrorInfo } from '@cohorte/base';\nimport { Command, CommanderError } from 'commander';\nimport {\n type CliContext,\n CONTROLLER_EXIT_CODES,\n type CommandArgs,\n EXIT_CODE_BY_CLASS,\n formatExitCodesHelp,\n VERBS,\n type VerbSpec,\n} from './contract/index.ts';\nimport { loadCliContext, loadCommandModule } from './lazy.ts';\n\n/** Mirrors `apps/cli/package.json` \"version\"; `apps/cli/test/registry/version.test.ts` reads that file and fails\n * if the two ever drift (a literal keeps `--version` free of any file read on the one-shot start-up path). */\nexport const COHORTE_VERSION = '3.0.0-dev.1';\n\nexport interface RuntimeDeps {\n readonly stdout: NodeJS.WritableStream;\n readonly stderr: NodeJS.WritableStream;\n /** Built lazily: only a verb whose action actually runs calls this (never `--help`/`--version`, DESIGN 1.3). */\n readonly context: () => Promise<CliContext>;\n}\n\nfunction printError(deps: RuntimeDeps, info: ReturnType<typeof toErrorInfo>): void {\n // spec 21: \"cause / impact / run / next action / exit code\"\n deps.stderr.write(`error: ${info.code}: ${info.message}\\n`);\n deps.stderr.write(`impact: ${info.impact}\\n`);\n deps.stderr.write(`next action: ${info.remediation}\\n`);\n}\n\n/** Loads the verb's module, builds its `CliContext` and runs it, converting any throw at this one boundary\n * (DESIGN 2.8: \"Every error has ... an exit code\"; the module itself never writes to stdio on error). */\nasync function dispatch(deps: RuntimeDeps, verb: string, args: CommandArgs): Promise<number> {\n try {\n const mod = await loadCommandModule(verb);\n const ctx = await deps.context();\n return await mod.run(ctx, args);\n } catch (error) {\n // DESIGN 2.8: \"Unknown throwables -> `<nearest class>/unexpected`\". A `CohorteError` keeps its own code through\n // `toErrorInfo`, so the Wave-0 stubs still answer `configuration/phase-not-available`; anything else — a\n // TypeError in a filled-in verb, a failed store open, a module that will not load — is reported as what it is.\n const info = toErrorInfo(error, { code: 'configuration/unexpected', class: 'configuration' });\n printError(deps, info);\n return EXIT_CODE_BY_CLASS[info.class];\n }\n}\n\ninterface ExitBox {\n code: number;\n}\n\nfunction addAction(command: Command, deps: RuntimeDeps, exit: ExitBox, verb: VerbSpec, subVerb?: string): void {\n command.allowUnknownOption(true).allowExcessArguments(true);\n // `--json` only where DESIGN 2.3.5 gives the verb a published document (`JSON_OUTPUTS`): registering it on every\n // verb would promise a machine output that no schema backs, and the Wave-4 `--json validates` tests read that map.\n if (verb.json) command.option('--json', 'print the machine-readable document for this verb (DESIGN 2.3.5)');\n command.argument('[args...]', 'verb arguments').action(async (positionals: string[], options: { json?: boolean }) => {\n const args: CommandArgs = {\n positionals,\n options,\n json: Boolean(options.json),\n ...(subVerb === undefined ? {} : { subVerb }),\n };\n exit.code = await dispatch(deps, verb.name, args);\n });\n}\n\n/** Builds the whole commander tree. Exported so a test can assert on `--help` / registration without spawning a\n * process (PLAN U0.10 test list: \"every DESIGN §9 verb is registered exactly once and appears in --help\"). */\nexport function buildProgram(deps: RuntimeDeps, exit: ExitBox): Command {\n const program = new Command('cohorte')\n .description('Cohorte: a durable multi-agent development pipeline with a runtime-independent orchestrator.')\n .version(COHORTE_VERSION, '--version', 'print the Cohorte version')\n .exitOverride()\n .configureOutput({\n writeOut: (str) => deps.stdout.write(str),\n writeErr: (str) => deps.stderr.write(str),\n })\n .addHelpText('after', `\\n${formatExitCodesHelp()}\\n`);\n\n for (const verb of VERBS) {\n const sub = program.command(verb.name, verb.hidden ? { hidden: true } : undefined).description(verb.summary);\n if (verb.subVerbs && verb.subVerbs.length > 0) {\n addAction(sub, deps, exit, verb); // bare `cohorte <verb>` with no sub-verb\n for (const subVerb of verb.subVerbs) {\n addAction(sub.command(subVerb), deps, exit, verb, subVerb);\n }\n } else {\n addAction(sub, deps, exit, verb);\n }\n }\n return program;\n}\n\n/**\n * `CONTROLLER_EXIT_CODES.usage` (2) for anything commander itself refuses (bad flag, unknown command, no command at\n * all), `completed` (0) for the routes where commander did exactly what was asked and then stopped the parse.\n *\n * Keyed off commander's OWN `exitCode`, not off the code NAME: commander raises `commander.help` both for the\n * advertised `help [command]` route (which prints the help and means exit 0) and for a bare `cohorte` with no\n * command (exit 1 there — a usage error), and an allow-list of names got the first case wrong while `--help`,\n * raising `commander.helpDisplayed`, was right. `error.exitCode` already separates the two.\n */\nfunction commanderExitCode(error: CommanderError): number {\n return error.exitCode === 0 ? CONTROLLER_EXIT_CODES.completed : CONTROLLER_EXIT_CODES.usage;\n}\n\n/** Parses `argv` (no leading node/script entries) and runs the matched verb. Never calls `process.exit`: the\n * caller (`main()` below, or a test) owns that decision. */\nexport async function runCli(argv: readonly string[], deps: RuntimeDeps): Promise<number> {\n const exit: ExitBox = { code: CONTROLLER_EXIT_CODES.completed };\n const program = buildProgram(deps, exit);\n try {\n await program.parseAsync(argv, { from: 'user' });\n } catch (error) {\n if (error instanceof CommanderError) return commanderExitCode(error);\n throw error;\n }\n return exit.code;\n}\n\nasync function realContext(): Promise<CliContext> {\n return loadCliContext({\n cwd: process.cwd(),\n env: process.env,\n stdio: { stdout: process.stdout, stderr: process.stderr, stdin: process.stdin },\n });\n}\n\nasync function main(): Promise<void> {\n const deps: RuntimeDeps = { stdout: process.stdout, stderr: process.stderr, context: realContext };\n const code = await runCli(process.argv.slice(2), deps);\n process.exitCode = code;\n}\n\n// `import.meta.main` (node >= 24.2; `apps/cli` engines are `^24.16.0 || >=26.1.0`) and NOT a hand-rolled\n// `import.meta.url === \\`file://${process.argv[1]}\\``: npm installs `bin` as a SYMLINK\n// (`node_modules/.bin/cohorte` -> `../cohorte/dist/cli.mjs`), so the comparison is false for every real install and\n// the published CLI would print nothing and exit 0. It also breaks on any install path with a space or a non-ASCII\n// character (`import.meta.url` is percent-encoded, `argv[1]` is not).\nif (import.meta.main) {\n main().catch((error: unknown) => {\n process.stderr.write(`fatal: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}\\n`);\n process.exitCode = 1;\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BA,MAAa,kBAAoE,OAAO,OAAO;CAC7F,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,gBAAgB,OAAO;CACvB,WAAW,OAAO;CAClB,cAAc,OAAO;CACrB,eAAe,OAAO;CACtB,cAAc,OAAO;CACrB,aAAa,OAAO;CACpB,cAAc,OAAO;CACrB,gBAAgB,OAAO;CACvB,eAAe,OAAO;CACtB,YAAY,OAAO;CACnB,aAAa,OAAO;CACpB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,WAAW,OAAO;CAClB,YAAY,OAAO;CACnB,YAAY,OAAO;CACnB,iBAAiB,OAAO;CACxB,c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sB,YAAY,sBAAsB;AACxF;;;AAIA,eAAsB,OAAO,MAAyB,MAAoC;CACxF,MAAM,OAAgB,EAAE,MAAM,sBAAsB,UAAU;CAC9D,MAAM,UAAU,aAAa,MAAM,IAAI;CACvC,IAAI;EACF,MAAM,QAAQ,WAAW,MAAM,EAAE,MAAM,OAAO,CAAC;CACjD,SAAS,OAAO;EACd,IAAI,iBAAiB,gBAAgB,OAAO,kBAAkB,KAAK;EACnE,MAAM;CACR;CACA,OAAO,KAAK;AACd;AAEA,eAAe,cAAmC;CAChD,OAAO,eAAe;EACpB,KAAK,QAAQ,IAAI;EACjB,KAAK,QAAQ;EACb,OAAO;GAAE,QAAQ,QAAQ;GAAQ,QAAQ,QAAQ;GAAQ,OAAO,QAAQ;EAAM;CAChF,CAAC;AACH;AAEA,eAAe,OAAsB;CACnC,MAAM,OAAoB;EAAE,QAAQ,QAAQ;EAAQ,QAAQ,QAAQ;EAAQ,SAAS;CAAY;CACjG,MAAM,OAAO,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC,GAAG,IAAI;CACrD,QAAQ,WAAW;AACrB;AAOA,IAAI,YAAY,MACd,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,OAAO,MAAM,UAAU,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK,EAAE,GAAG;CAC1G,QAAQ,WAAW;AACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-D8rCVY33.mjs","names":[],"sources":["../../../../apps/cli/src/commands/auth/index.ts"],"sourcesContent":["// apps/cli/src/commands/auth/index.ts — DESIGN §9 verb `auth` (PLAN §3 rule 3 \"later units fill\n// stub files that lie inside their owned paths; they never edit ... the registry\"). Wave-0 stub: exits with the\n// documented not-available error (spec 24 `configuration/phase-not-available`); filled by the Wave-4/5\n// unit that owns `apps/cli/src/commands/auth/**`.\nimport { createInterface } from 'node:readline/promises';\nimport type { ProviderAuthStatus } from '@cohorte/runtime-contract';\nimport type { CommandModule } from '../../contract/index.ts';\n\nfunction document(ctx: Parameters<CommandModule['run']>[0], statuses: ProviderAuthStatus[]) {\n return {\n documentVersion: 1,\n generatedAt: ctx.clock.now(),\n runtime: (() => {\n const runtime = ctx.runtime.resolve();\n return { id: runtime.id, version: 'unknown' };\n })(),\n providers: statuses.map((status) => ({\n ...status,\n ...(status.accountLabel === undefined ? { accountLabelNote: 'account: not exposed by the engine' } : {}),\n })),\n };\n}\n\nfunction print(ctx: Parameters<CommandModule['run']>[0], value: ReturnType<typeof document>): void {\n if (ctx.stdio.stdout && value) ctx.stdio.stdout.write(`${JSON.stringify(value)}\\n`);\n}\n\nasync function loginUi(ctx: Parameters<CommandModule['run']>[0], signal: AbortSignal) {\n const readline = createInterface({ input: ctx.stdio.stdin, output: ctx.stdio.stdout, terminal: false });\n const abort = () => readline.close();\n signal.addEventListener('abort', abort, { once: true });\n return {\n show(event: {\n kind: string;\n url?: string;\n instructions?: string;\n message?: string;\n userCode?: string;\n verificationUri?: string;\n }) {\n const text = event.message ?? event.instructions ?? event.url ?? event.verificationUri ?? event.userCode ?? '';\n if (text) ctx.stdio.stdout.write(`${text}\\n`);\n },\n async ask(prompt: { kind: string; message: string }) {\n return readline.question(`${prompt.message} `);\n },\n close() {\n signal.removeEventListener('abort', abort);\n readline.close();\n },\n };\n}\n\nconst auth: CommandModule = {\n verb: 'auth',\n async run(ctx, args) {\n const runtime = ctx.runtime.resolve();\n const provider = args.positionals[0];\n if (args.subVerb === 'status' || args.subVerb === undefined) {\n const statuses = await runtime.authStatus(provider ? [provider] : ['openai-codex', 'anthropic']);\n const value = document(ctx, statuses);\n if (args.json) print(ctx, value);\n else\n for (const status of value.providers)\n ctx.stdio.stdout.write(`${status.provider}: ${status.state} (${status.billing})\\n`);\n return 0;\n }\n if (!provider) return 2;\n if (args.subVerb === 'logout') {\n await runtime.logout(provider);\n const value = document(ctx, await runtime.authStatus([provider]));\n if (args.json) print(ctx, value);\n else ctx.stdio.stdout.write(`${provider}: logged out\\n`);\n return 0;\n }\n if (args.subVerb === 'login') {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 10 * 60_000);\n const ui = await loginUi(ctx, controller.signal);\n try {\n const status = await runtime.login(provider, ui, controller.signal);\n const value = document(ctx, [status]);\n if (args.json) print(ctx, value);\n else ctx.stdio.stdout.write(`${status.provider}: ${status.state}\\n`);\n return 0;\n } finally {\n clearTimeout(timeout);\n ui.close();\n }\n }\n return 10;\n },\n};\n\nexport default auth;\n"],"mappings":";;AAQA,SAAS,SAAS,KAA0C,UAAgC;CAC1F,OAAO;EACL,iBAAiB;EACjB,aAAa,IAAI,MAAM,IAAI;EAC3B,gBAAgB;GAEd,OAAO;IAAE,IADO,IAAI,QAAQ,QACT,CAAC,CAAC;IAAI,SAAS;GAAU;EAC9C,EAAA,CAAG;EACH,WAAW,SAAS,KAAK,YAAY;GACnC,GAAG;GACH,GAAI,OAAO,iBAAiB,KAAA,IAAY,EAAE,kBAAkB,qCAAqC,IAAI,CAAC;EACxG,EAAE;CACJ;AACF;AAEA,SAAS,MAAM,KAA0C,OAA0C;CACjG,IAAI,IAAI,MAAM,UAAU,OAAO,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,UAAU,KAAK,EAAE,GAAG;AACpF;AAEA,eAAe,QAAQ,KAA0C,QAAqB;CACpF,MAAM,WAAW,gBAAgB;EAAE,OAAO,IAAI,MAAM;EAAO,QAAQ,IAAI,MAAM;EAAQ,UAAU;CAAM,CAAC;CACtG,MAAM,cAAc,SAAS,MAAM;CACnC,OAAO,iBAAiB,SAAS,OAAO,EAAE,MAAM,KAAK,CAAC;CACtD,OAAO;EACL,KAAK,OAOF;GACD,MAAM,OAAO,MAAM,WAAW,MAAM,gBAAgB,MAAM,OAAO,MAAM,mBAAmB,MAAM,YAAY;GAC5G,IAAI,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,KAAK,GAAG;EAC9C;EACA,MAAM,IAAI,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