create-agentfs 0.1.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/LICENSE +21 -0
- package/README.md +238 -0
- package/dist/cli.d.ts +51 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +246 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/compile.d.ts +48 -0
- package/dist/commands/compile.d.ts.map +1 -0
- package/dist/commands/compile.js +228 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/cron.d.ts +18 -0
- package/dist/commands/cron.d.ts.map +1 -0
- package/dist/commands/cron.js +95 -0
- package/dist/commands/cron.js.map +1 -0
- package/dist/commands/doctor.d.ts +11 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +199 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/memory.d.ts +19 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +213 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/onboard.d.ts +31 -0
- package/dist/commands/onboard.d.ts.map +1 -0
- package/dist/commands/onboard.js +362 -0
- package/dist/commands/onboard.js.map +1 -0
- package/dist/commands/secret.d.ts +13 -0
- package/dist/commands/secret.d.ts.map +1 -0
- package/dist/commands/secret.js +109 -0
- package/dist/commands/secret.js.map +1 -0
- package/dist/commands/security.d.ts +16 -0
- package/dist/commands/security.d.ts.map +1 -0
- package/dist/commands/security.js +203 -0
- package/dist/commands/security.js.map +1 -0
- package/dist/commands/sync.d.ts +14 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +84 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/compilers/agent-map.d.ts +34 -0
- package/dist/compilers/agent-map.d.ts.map +1 -0
- package/dist/compilers/agent-map.js +66 -0
- package/dist/compilers/agent-map.js.map +1 -0
- package/dist/compilers/base.d.ts +67 -0
- package/dist/compilers/base.d.ts.map +1 -0
- package/dist/compilers/base.js +183 -0
- package/dist/compilers/base.js.map +1 -0
- package/dist/compilers/claude.d.ts +26 -0
- package/dist/compilers/claude.d.ts.map +1 -0
- package/dist/compilers/claude.js +151 -0
- package/dist/compilers/claude.js.map +1 -0
- package/dist/compilers/cursor.d.ts +11 -0
- package/dist/compilers/cursor.d.ts.map +1 -0
- package/dist/compilers/cursor.js +52 -0
- package/dist/compilers/cursor.js.map +1 -0
- package/dist/compilers/index.d.ts +14 -0
- package/dist/compilers/index.d.ts.map +1 -0
- package/dist/compilers/index.js +14 -0
- package/dist/compilers/index.js.map +1 -0
- package/dist/compilers/openclaw.d.ts +12 -0
- package/dist/compilers/openclaw.d.ts.map +1 -0
- package/dist/compilers/openclaw.js +51 -0
- package/dist/compilers/openclaw.js.map +1 -0
- package/dist/cron/index.d.ts +10 -0
- package/dist/cron/index.d.ts.map +1 -0
- package/dist/cron/index.js +9 -0
- package/dist/cron/index.js.map +1 -0
- package/dist/cron/jobs/consolidate.d.ts +16 -0
- package/dist/cron/jobs/consolidate.d.ts.map +1 -0
- package/dist/cron/jobs/consolidate.js +61 -0
- package/dist/cron/jobs/consolidate.js.map +1 -0
- package/dist/cron/jobs/heartbeat.d.ts +11 -0
- package/dist/cron/jobs/heartbeat.d.ts.map +1 -0
- package/dist/cron/jobs/heartbeat.js +66 -0
- package/dist/cron/jobs/heartbeat.js.map +1 -0
- package/dist/cron/jobs/inbox-triage.d.ts +11 -0
- package/dist/cron/jobs/inbox-triage.d.ts.map +1 -0
- package/dist/cron/jobs/inbox-triage.js +85 -0
- package/dist/cron/jobs/inbox-triage.js.map +1 -0
- package/dist/cron/runner.d.ts +32 -0
- package/dist/cron/runner.d.ts.map +1 -0
- package/dist/cron/runner.js +69 -0
- package/dist/cron/runner.js.map +1 -0
- package/dist/cron/types.d.ts +21 -0
- package/dist/cron/types.d.ts.map +1 -0
- package/dist/cron/types.js +6 -0
- package/dist/cron/types.js.map +1 -0
- package/dist/generators/filesystem.d.ts +52 -0
- package/dist/generators/filesystem.d.ts.map +1 -0
- package/dist/generators/filesystem.js +155 -0
- package/dist/generators/filesystem.js.map +1 -0
- package/dist/generators/ignore.d.ts +38 -0
- package/dist/generators/ignore.d.ts.map +1 -0
- package/dist/generators/ignore.js +154 -0
- package/dist/generators/ignore.js.map +1 -0
- package/dist/generators/index.d.ts +14 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +14 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/init.d.ts +37 -0
- package/dist/generators/init.d.ts.map +1 -0
- package/dist/generators/init.js +169 -0
- package/dist/generators/init.js.map +1 -0
- package/dist/generators/manifest.d.ts +31 -0
- package/dist/generators/manifest.d.ts.map +1 -0
- package/dist/generators/manifest.js +123 -0
- package/dist/generators/manifest.js.map +1 -0
- package/dist/generators/memory.d.ts +36 -0
- package/dist/generators/memory.d.ts.map +1 -0
- package/dist/generators/memory.js +106 -0
- package/dist/generators/memory.js.map +1 -0
- package/dist/generators/profiles.d.ts +22 -0
- package/dist/generators/profiles.d.ts.map +1 -0
- package/dist/generators/profiles.js +92 -0
- package/dist/generators/profiles.js.map +1 -0
- package/dist/generators/prompts.d.ts +24 -0
- package/dist/generators/prompts.d.ts.map +1 -0
- package/dist/generators/prompts.js +122 -0
- package/dist/generators/prompts.js.map +1 -0
- package/dist/generators/scaffold.d.ts +29 -0
- package/dist/generators/scaffold.d.ts.map +1 -0
- package/dist/generators/scaffold.js +90 -0
- package/dist/generators/scaffold.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/memory/confidence.d.ts +69 -0
- package/dist/memory/confidence.d.ts.map +1 -0
- package/dist/memory/confidence.js +125 -0
- package/dist/memory/confidence.js.map +1 -0
- package/dist/memory/episodic.d.ts +40 -0
- package/dist/memory/episodic.d.ts.map +1 -0
- package/dist/memory/episodic.js +139 -0
- package/dist/memory/episodic.js.map +1 -0
- package/dist/memory/index.d.ts +17 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +17 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/parser.d.ts +73 -0
- package/dist/memory/parser.d.ts.map +1 -0
- package/dist/memory/parser.js +156 -0
- package/dist/memory/parser.js.map +1 -0
- package/dist/memory/procedural.d.ts +43 -0
- package/dist/memory/procedural.d.ts.map +1 -0
- package/dist/memory/procedural.js +126 -0
- package/dist/memory/procedural.js.map +1 -0
- package/dist/secrets/exfil-guard.d.ts +31 -0
- package/dist/secrets/exfil-guard.d.ts.map +1 -0
- package/dist/secrets/exfil-guard.js +51 -0
- package/dist/secrets/exfil-guard.js.map +1 -0
- package/dist/secrets/index.d.ts +8 -0
- package/dist/secrets/index.d.ts.map +1 -0
- package/dist/secrets/index.js +7 -0
- package/dist/secrets/index.js.map +1 -0
- package/dist/secrets/vault.d.ts +63 -0
- package/dist/secrets/vault.d.ts.map +1 -0
- package/dist/secrets/vault.js +163 -0
- package/dist/secrets/vault.js.map +1 -0
- package/dist/security/claude-compiler.d.ts +28 -0
- package/dist/security/claude-compiler.d.ts.map +1 -0
- package/dist/security/claude-compiler.js +66 -0
- package/dist/security/claude-compiler.js.map +1 -0
- package/dist/security/index.d.ts +7 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +7 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/parser.d.ts +47 -0
- package/dist/security/parser.d.ts.map +1 -0
- package/dist/security/parser.js +136 -0
- package/dist/security/parser.js.map +1 -0
- package/dist/sync/index.d.ts +7 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +6 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/sync.d.ts +46 -0
- package/dist/sync/sync.d.ts.map +1 -0
- package/dist/sync/sync.js +174 -0
- package/dist/sync/sync.js.map +1 -0
- package/dist/types/compiler.d.ts +81 -0
- package/dist/types/compiler.d.ts.map +1 -0
- package/dist/types/compiler.js +10 -0
- package/dist/types/compiler.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/manifest.d.ts +112 -0
- package/dist/types/manifest.d.ts.map +1 -0
- package/dist/types/manifest.js +10 -0
- package/dist/types/manifest.js.map +1 -0
- package/dist/types/memory.d.ts +85 -0
- package/dist/types/memory.d.ts.map +1 -0
- package/dist/types/memory.js +20 -0
- package/dist/types/memory.js.map +1 -0
- package/dist/types/security.d.ts +67 -0
- package/dist/types/security.d.ts.map +1 -0
- package/dist/types/security.js +10 -0
- package/dist/types/security.js.map +1 -0
- package/dist/types/setup.d.ts +54 -0
- package/dist/types/setup.d.ts.map +1 -0
- package/dist/types/setup.js +9 -0
- package/dist/types/setup.js.map +1 -0
- package/dist/utils/fhs-mapping.d.ts +76 -0
- package/dist/utils/fhs-mapping.d.ts.map +1 -0
- package/dist/utils/fhs-mapping.js +189 -0
- package/dist/utils/fhs-mapping.js.map +1 -0
- package/package.json +58 -0
- package/templates/compilers/agent-map.md.hbs +36 -0
- package/templates/compilers/claude.md.hbs +95 -0
- package/templates/procedural/code-review.md +54 -0
- package/templates/procedural/debugging.md +52 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ignore Files Generator — creates `.gitignore` and `.agentignore` at vault root.
|
|
3
|
+
*
|
|
4
|
+
* `.gitignore` protects runtime state and secrets from accidental commits.
|
|
5
|
+
* `.agentignore` enforces an agent-level read barrier over secrets and PII.
|
|
6
|
+
*
|
|
7
|
+
* Both files are written idempotently:
|
|
8
|
+
* - `.gitignore` — if the file exists, only absent lines are appended.
|
|
9
|
+
* - `.agentignore` — if the file exists, it is skipped entirely.
|
|
10
|
+
*
|
|
11
|
+
* @see docs/architecture.md Section 15 "Security Model"
|
|
12
|
+
* @module generators/ignore
|
|
13
|
+
*/
|
|
14
|
+
import type { SetupAnswers, GeneratorResult } from '../types/index.js';
|
|
15
|
+
/**
|
|
16
|
+
* Generates `.gitignore` and `.agentignore` at the vault root.
|
|
17
|
+
*
|
|
18
|
+
* `.gitignore` handling:
|
|
19
|
+
* - If the file does not exist, it is created with all managed lines.
|
|
20
|
+
* - If the file already exists, only lines that are not already present are
|
|
21
|
+
* appended (blank-line separator added before the new block).
|
|
22
|
+
*
|
|
23
|
+
* `.agentignore` handling:
|
|
24
|
+
* - If the file does not exist, it is created with the full managed content.
|
|
25
|
+
* - If the file already exists, it is skipped entirely.
|
|
26
|
+
*
|
|
27
|
+
* @param answers - Setup answers from the interactive wizard.
|
|
28
|
+
* @returns A `GeneratorResult` listing created and skipped paths.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const result = await generateIgnoreFiles(answers);
|
|
33
|
+
* console.log(result.created); // ['.gitignore', '.agentignore']
|
|
34
|
+
* console.log(result.skipped); // []
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function generateIgnoreFiles(answers: SetupAnswers): Promise<GeneratorResult>;
|
|
38
|
+
//# sourceMappingURL=ignore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../../src/generators/ignore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA+EvE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAiDzF"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ignore Files Generator — creates `.gitignore` and `.agentignore` at vault root.
|
|
3
|
+
*
|
|
4
|
+
* `.gitignore` protects runtime state and secrets from accidental commits.
|
|
5
|
+
* `.agentignore` enforces an agent-level read barrier over secrets and PII.
|
|
6
|
+
*
|
|
7
|
+
* Both files are written idempotently:
|
|
8
|
+
* - `.gitignore` — if the file exists, only absent lines are appended.
|
|
9
|
+
* - `.agentignore` — if the file exists, it is skipped entirely.
|
|
10
|
+
*
|
|
11
|
+
* @see docs/architecture.md Section 15 "Security Model"
|
|
12
|
+
* @module generators/ignore
|
|
13
|
+
*/
|
|
14
|
+
import fs from 'node:fs/promises';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Constants
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
/**
|
|
20
|
+
* Lines written to (or appended into) `.gitignore`.
|
|
21
|
+
*
|
|
22
|
+
* Covers runtime state directories that must never be committed:
|
|
23
|
+
* active process state, decrypted secrets, and per-agent session logs.
|
|
24
|
+
*/
|
|
25
|
+
const GITIGNORE_LINES = [
|
|
26
|
+
'# Runtime state — never commit',
|
|
27
|
+
'.agentos/proc/',
|
|
28
|
+
'.agentos/secrets/decrypted/',
|
|
29
|
+
'',
|
|
30
|
+
'# Agent sessions and runtime data',
|
|
31
|
+
'.claude/sessions/',
|
|
32
|
+
'.claude/mcp/',
|
|
33
|
+
'.omc/sessions/',
|
|
34
|
+
'.omc/state/',
|
|
35
|
+
'.omc/telemetry/',
|
|
36
|
+
'.cursor/',
|
|
37
|
+
'',
|
|
38
|
+
'# Obsidian runtime',
|
|
39
|
+
'.obsidian/workspace*.json',
|
|
40
|
+
'.obsidian/plugins/',
|
|
41
|
+
'',
|
|
42
|
+
'# Smart environment (AI indexing)',
|
|
43
|
+
'.smart-env/',
|
|
44
|
+
];
|
|
45
|
+
/**
|
|
46
|
+
* Full content written to `.agentignore` when the file does not yet exist.
|
|
47
|
+
*
|
|
48
|
+
* Declares directories and glob patterns that agents must never read directly.
|
|
49
|
+
* Covers raw secrets, PII, and foreign-agent session files.
|
|
50
|
+
*/
|
|
51
|
+
const AGENTIGNORE_CONTENT = `# Secrets — agent must NEVER read directly
|
|
52
|
+
.agentos/secrets/
|
|
53
|
+
**/.env
|
|
54
|
+
**/*.key
|
|
55
|
+
**/*.pem
|
|
56
|
+
**/*credentials*
|
|
57
|
+
**/*token*
|
|
58
|
+
|
|
59
|
+
# PII
|
|
60
|
+
People/**/private-notes.md
|
|
61
|
+
|
|
62
|
+
# Other agent sessions
|
|
63
|
+
.claude/sessions/
|
|
64
|
+
.omc/sessions/
|
|
65
|
+
`;
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
// Helpers
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
/**
|
|
70
|
+
* Reads an existing text file and returns its lines, or an empty array when
|
|
71
|
+
* the file does not exist.
|
|
72
|
+
*
|
|
73
|
+
* @param filePath - Absolute path to the file to read.
|
|
74
|
+
* @returns Array of lines with newlines stripped.
|
|
75
|
+
*/
|
|
76
|
+
async function readLinesIfExists(filePath) {
|
|
77
|
+
try {
|
|
78
|
+
const content = await fs.readFile(filePath, 'utf8');
|
|
79
|
+
return content.split('\n');
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
// generateIgnoreFiles
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
/**
|
|
89
|
+
* Generates `.gitignore` and `.agentignore` at the vault root.
|
|
90
|
+
*
|
|
91
|
+
* `.gitignore` handling:
|
|
92
|
+
* - If the file does not exist, it is created with all managed lines.
|
|
93
|
+
* - If the file already exists, only lines that are not already present are
|
|
94
|
+
* appended (blank-line separator added before the new block).
|
|
95
|
+
*
|
|
96
|
+
* `.agentignore` handling:
|
|
97
|
+
* - If the file does not exist, it is created with the full managed content.
|
|
98
|
+
* - If the file already exists, it is skipped entirely.
|
|
99
|
+
*
|
|
100
|
+
* @param answers - Setup answers from the interactive wizard.
|
|
101
|
+
* @returns A `GeneratorResult` listing created and skipped paths.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const result = await generateIgnoreFiles(answers);
|
|
106
|
+
* console.log(result.created); // ['.gitignore', '.agentignore']
|
|
107
|
+
* console.log(result.skipped); // []
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export async function generateIgnoreFiles(answers) {
|
|
111
|
+
const result = { created: [], skipped: [] };
|
|
112
|
+
// -------------------------------------------------------------------------
|
|
113
|
+
// .gitignore — append-only merge
|
|
114
|
+
// -------------------------------------------------------------------------
|
|
115
|
+
const gitignorePath = path.join(answers.targetDir, '.gitignore');
|
|
116
|
+
const existingLines = await readLinesIfExists(gitignorePath);
|
|
117
|
+
const existingSet = new Set(existingLines.map((l) => l.trim()));
|
|
118
|
+
const missingLines = GITIGNORE_LINES.filter((line) => {
|
|
119
|
+
// Always insert comment headers if the exact comment is absent;
|
|
120
|
+
// always insert blank separators implicitly via the join below.
|
|
121
|
+
return !existingSet.has(line.trim());
|
|
122
|
+
});
|
|
123
|
+
if (existingLines.length === 0) {
|
|
124
|
+
// File does not exist — write it fresh.
|
|
125
|
+
await fs.writeFile(gitignorePath, GITIGNORE_LINES.join('\n') + '\n', 'utf8');
|
|
126
|
+
result.created.push('.gitignore');
|
|
127
|
+
}
|
|
128
|
+
else if (missingLines.length > 0) {
|
|
129
|
+
// File exists — append only the lines that are not present.
|
|
130
|
+
const appendBlock = '\n' + missingLines.join('\n') + '\n';
|
|
131
|
+
await fs.appendFile(gitignorePath, appendBlock, 'utf8');
|
|
132
|
+
result.created.push('.gitignore');
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
// All lines already present — skip.
|
|
136
|
+
result.skipped.push('.gitignore');
|
|
137
|
+
}
|
|
138
|
+
// -------------------------------------------------------------------------
|
|
139
|
+
// .agentignore — create or skip
|
|
140
|
+
// -------------------------------------------------------------------------
|
|
141
|
+
const agentignorePath = path.join(answers.targetDir, '.agentignore');
|
|
142
|
+
try {
|
|
143
|
+
await fs.access(agentignorePath);
|
|
144
|
+
// File already exists — skip.
|
|
145
|
+
result.skipped.push('.agentignore');
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
// File does not exist — write it.
|
|
149
|
+
await fs.writeFile(agentignorePath, AGENTIGNORE_CONTENT, 'utf8');
|
|
150
|
+
result.created.push('.agentignore');
|
|
151
|
+
}
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=ignore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore.js","sourceRoot":"","sources":["../../src/generators/ignore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,eAAe,GAAsB;IACzC,gCAAgC;IAChC,gBAAgB;IAChB,6BAA6B;IAC7B,EAAE;IACF,mCAAmC;IACnC,mBAAmB;IACnB,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,iBAAiB;IACjB,UAAU;IACV,EAAE;IACF,oBAAoB;IACpB,2BAA2B;IAC3B,oBAAoB;IACpB,EAAE;IACF,mCAAmC;IACnC,aAAa;CACd,CAAC;AAEF;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;CAc3B,CAAC;AAEF,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;GAMG;AACH,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IAC/C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACpD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,8EAA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,EAAE,MAAM,CAAC,CAAC;QACxD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,oCAAoC;QACpC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC;IAED,4EAA4E;IAC5E,gCAAgC;IAChC,4EAA4E;IAE5E,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAErE,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACjC,8BAA8B;QAC9B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,kCAAkC;QAClC,MAAM,EAAE,CAAC,SAAS,CAAC,eAAe,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;QACjE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentFS generators — barrel export.
|
|
3
|
+
*
|
|
4
|
+
* Generators are one-shot scaffold-time modules. Each creates
|
|
5
|
+
* a specific part of the vault structure from SetupAnswers.
|
|
6
|
+
*/
|
|
7
|
+
export { runSetupPrompts, createDefaultAnswers } from './prompts.js';
|
|
8
|
+
export { generateFilesystem } from './filesystem.js';
|
|
9
|
+
export { generateManifest } from './manifest.js';
|
|
10
|
+
export { generateInitScripts } from './init.js';
|
|
11
|
+
export { generateIgnoreFiles } from './ignore.js';
|
|
12
|
+
export { generateMemoryFiles } from './memory.js';
|
|
13
|
+
export { scaffold, formatScaffoldSummary } from './scaffold.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentFS generators — barrel export.
|
|
3
|
+
*
|
|
4
|
+
* Generators are one-shot scaffold-time modules. Each creates
|
|
5
|
+
* a specific part of the vault structure from SetupAnswers.
|
|
6
|
+
*/
|
|
7
|
+
export { runSetupPrompts, createDefaultAnswers } from './prompts.js';
|
|
8
|
+
export { generateFilesystem } from './filesystem.js';
|
|
9
|
+
export { generateManifest } from './manifest.js';
|
|
10
|
+
export { generateInitScripts } from './init.js';
|
|
11
|
+
export { generateIgnoreFiles } from './ignore.js';
|
|
12
|
+
export { generateMemoryFiles } from './memory.js';
|
|
13
|
+
export { scaffold, formatScaffoldSummary } from './scaffold.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init Scripts Generator — creates `.agentos/init.d/` boot scripts.
|
|
3
|
+
*
|
|
4
|
+
* Generates four SysVinit-style boot scripts that agents load at startup.
|
|
5
|
+
* Each script follows the runlevel 3 boot sequence defined in the manifest.
|
|
6
|
+
* All writes are idempotent: existing files are skipped, never overwritten.
|
|
7
|
+
*
|
|
8
|
+
* @see docs/architecture.md Section 4 "Boot Sequence"
|
|
9
|
+
* @module generators/init
|
|
10
|
+
*/
|
|
11
|
+
import type { SetupAnswers, GeneratorResult } from '../types/index.js';
|
|
12
|
+
/**
|
|
13
|
+
* Generates the four `init.d/` boot scripts inside the target vault.
|
|
14
|
+
*
|
|
15
|
+
* Scripts produced (in load order):
|
|
16
|
+
* - `00-identity.md` — owner info, agent rules, vault path map
|
|
17
|
+
* - `10-memory.md` — Tulving memory bootstrap strategy
|
|
18
|
+
* - `20-today.md` — daily note and active task references
|
|
19
|
+
* - `30-projects.md` — active project detection instructions
|
|
20
|
+
*
|
|
21
|
+
* Behaviour:
|
|
22
|
+
* - Creates `.agentos/init.d/` directory if absent (recursive, safe).
|
|
23
|
+
* - Skips any file that already exists (idempotent).
|
|
24
|
+
* - Relative paths are reported in `GeneratorResult` for display.
|
|
25
|
+
*
|
|
26
|
+
* @param answers - Setup answers from the interactive wizard.
|
|
27
|
+
* @returns A `GeneratorResult` listing created and skipped paths.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const result = await generateInitScripts(answers);
|
|
32
|
+
* console.log(result.created); // ['.agentos/init.d/00-identity.md', ...]
|
|
33
|
+
* console.log(result.skipped); // []
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function generateInitScripts(answers: SetupAnswers): Promise<GeneratorResult>;
|
|
37
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/generators/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAqHvE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CA+BzF"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init Scripts Generator — creates `.agentos/init.d/` boot scripts.
|
|
3
|
+
*
|
|
4
|
+
* Generates four SysVinit-style boot scripts that agents load at startup.
|
|
5
|
+
* Each script follows the runlevel 3 boot sequence defined in the manifest.
|
|
6
|
+
* All writes are idempotent: existing files are skipped, never overwritten.
|
|
7
|
+
*
|
|
8
|
+
* @see docs/architecture.md Section 4 "Boot Sequence"
|
|
9
|
+
* @module generators/init
|
|
10
|
+
*/
|
|
11
|
+
import fs from 'node:fs/promises';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { getDefaultPaths } from '../utils/fhs-mapping.js';
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Helpers
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
/**
|
|
18
|
+
* Returns today's date formatted as YYYY-MM-DD (local time).
|
|
19
|
+
*/
|
|
20
|
+
function todayIso() {
|
|
21
|
+
return new Date().toISOString().slice(0, 10);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Formats the FHS path table for the 00-identity.md vault paths section.
|
|
25
|
+
*
|
|
26
|
+
* Each line is a bullet mapping the FHS key to its vault directory, e.g.:
|
|
27
|
+
* - tmp → Inbox
|
|
28
|
+
*
|
|
29
|
+
* @param paths - Resolved FhsPaths for the chosen profile.
|
|
30
|
+
* @returns Markdown bullet list, one mapping per defined path.
|
|
31
|
+
*/
|
|
32
|
+
function formatPathMappings(paths) {
|
|
33
|
+
return Object.entries(paths)
|
|
34
|
+
.filter((entry) => entry[1] !== undefined)
|
|
35
|
+
.map(([key, dir]) => `- ${key} → ${dir}`)
|
|
36
|
+
.join('\n');
|
|
37
|
+
}
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// Script content builders
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
/**
|
|
42
|
+
* Builds the content of `00-identity.md`.
|
|
43
|
+
*
|
|
44
|
+
* Embeds the owner name and the full FHS→vault path mapping for the chosen
|
|
45
|
+
* profile so agents know where every standard directory lives at boot.
|
|
46
|
+
*/
|
|
47
|
+
function buildIdentityScript(ownerName, paths) {
|
|
48
|
+
return `# Agent Identity
|
|
49
|
+
|
|
50
|
+
## Owner
|
|
51
|
+
- Name: ${ownerName}
|
|
52
|
+
- Role: (to be filled during onboard)
|
|
53
|
+
- Style: (to be filled during onboard)
|
|
54
|
+
|
|
55
|
+
## Agent Rules
|
|
56
|
+
- Follow vault conventions (frontmatter, naming, paths)
|
|
57
|
+
- Challenge weak decisions
|
|
58
|
+
- Don't repeat the obvious
|
|
59
|
+
|
|
60
|
+
## Vault Paths
|
|
61
|
+
${formatPathMappings(paths)}
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Builds the content of `10-memory.md`.
|
|
66
|
+
*
|
|
67
|
+
* Declares Tulving's taxonomy loading strategy: semantic memory is always
|
|
68
|
+
* loaded at boot; episodic and procedural memories are lazy-loaded on demand.
|
|
69
|
+
*/
|
|
70
|
+
function buildMemoryScript() {
|
|
71
|
+
return `# Memory Bootstrap (Tulving's taxonomy)
|
|
72
|
+
|
|
73
|
+
## Always load:
|
|
74
|
+
- .agentos/memory/semantic.md
|
|
75
|
+
- .agentos/memory/corrections.md
|
|
76
|
+
|
|
77
|
+
## Lazy load (on demand):
|
|
78
|
+
- .agentos/memory/episodic/ — load specific day when needed
|
|
79
|
+
- .agentos/memory/procedural/ — load specific skill when needed
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Builds the content of `20-today.md`.
|
|
84
|
+
*
|
|
85
|
+
* Points the agent at today's daily note and the active task queue files,
|
|
86
|
+
* using the vault paths resolved from the chosen profile.
|
|
87
|
+
*/
|
|
88
|
+
function buildTodayScript(paths) {
|
|
89
|
+
return `# Daily Context
|
|
90
|
+
|
|
91
|
+
## Load today's daily note:
|
|
92
|
+
- ${paths.log}/${todayIso()}.md
|
|
93
|
+
|
|
94
|
+
## Load active tasks:
|
|
95
|
+
- ${paths.spool}/priorities.md
|
|
96
|
+
- ${paths.spool}/backlog.md
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Builds the content of `30-projects.md`.
|
|
101
|
+
*
|
|
102
|
+
* Instructs the agent to scan project directories for READMEs and detect
|
|
103
|
+
* active projects via frontmatter status fields.
|
|
104
|
+
*/
|
|
105
|
+
function buildProjectsScript(paths) {
|
|
106
|
+
return `# Active Projects
|
|
107
|
+
|
|
108
|
+
## Load project READMEs from:
|
|
109
|
+
- ${paths.home}/*/README.md
|
|
110
|
+
|
|
111
|
+
## Active project detection:
|
|
112
|
+
- Look for status: active in frontmatter
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
// ---------------------------------------------------------------------------
|
|
116
|
+
// generateInitScripts
|
|
117
|
+
// ---------------------------------------------------------------------------
|
|
118
|
+
/**
|
|
119
|
+
* Generates the four `init.d/` boot scripts inside the target vault.
|
|
120
|
+
*
|
|
121
|
+
* Scripts produced (in load order):
|
|
122
|
+
* - `00-identity.md` — owner info, agent rules, vault path map
|
|
123
|
+
* - `10-memory.md` — Tulving memory bootstrap strategy
|
|
124
|
+
* - `20-today.md` — daily note and active task references
|
|
125
|
+
* - `30-projects.md` — active project detection instructions
|
|
126
|
+
*
|
|
127
|
+
* Behaviour:
|
|
128
|
+
* - Creates `.agentos/init.d/` directory if absent (recursive, safe).
|
|
129
|
+
* - Skips any file that already exists (idempotent).
|
|
130
|
+
* - Relative paths are reported in `GeneratorResult` for display.
|
|
131
|
+
*
|
|
132
|
+
* @param answers - Setup answers from the interactive wizard.
|
|
133
|
+
* @returns A `GeneratorResult` listing created and skipped paths.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const result = await generateInitScripts(answers);
|
|
138
|
+
* console.log(result.created); // ['.agentos/init.d/00-identity.md', ...]
|
|
139
|
+
* console.log(result.skipped); // []
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export async function generateInitScripts(answers) {
|
|
143
|
+
const result = { created: [], skipped: [] };
|
|
144
|
+
const initDir = path.join(answers.targetDir, '.agentos', 'init.d');
|
|
145
|
+
await fs.mkdir(initDir, { recursive: true });
|
|
146
|
+
const paths = getDefaultPaths(answers.profile);
|
|
147
|
+
const scripts = [
|
|
148
|
+
{ name: '00-identity.md', content: buildIdentityScript(answers.ownerName, paths) },
|
|
149
|
+
{ name: '10-memory.md', content: buildMemoryScript() },
|
|
150
|
+
{ name: '20-today.md', content: buildTodayScript(paths) },
|
|
151
|
+
{ name: '30-projects.md', content: buildProjectsScript(paths) },
|
|
152
|
+
];
|
|
153
|
+
for (const script of scripts) {
|
|
154
|
+
const absPath = path.join(initDir, script.name);
|
|
155
|
+
const relPath = path.join('.agentos', 'init.d', script.name);
|
|
156
|
+
try {
|
|
157
|
+
await fs.access(absPath);
|
|
158
|
+
// File already exists — skip.
|
|
159
|
+
result.skipped.push(relPath);
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
// File does not exist — write it.
|
|
163
|
+
await fs.writeFile(absPath, script.content, 'utf8');
|
|
164
|
+
result.created.push(relPath);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/generators/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;GAEG;AACH,SAAS,QAAQ;IACf,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CAAC,KAAe;IACzC,OAAQ,MAAM,CAAC,OAAO,CAAC,KAAK,CAA4C;SACrE,MAAM,CAAC,CAAC,KAAK,EAAqC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;SAC5E,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,MAAM,GAAG,EAAE,CAAC;SACxC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,SAAiB,EAAE,KAAe;IAC7D,OAAO;;;UAGC,SAAS;;;;;;;;;;EAUjB,kBAAkB,CAAC,KAAK,CAAC;CAC1B,CAAC;AACF,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB;IACxB,OAAO;;;;;;;;;CASR,CAAC;AACF,CAAC;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,KAAe;IACvC,OAAO;;;I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D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAE7D,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACzB,8BAA8B;YAC9B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,kCAAkC;YAClC,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACpD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest Generator — creates `.agentos/manifest.yaml`.
|
|
3
|
+
*
|
|
4
|
+
* Builds the kernel-space manifest from interactive setup answers and
|
|
5
|
+
* writes it to `{targetDir}/.agentos/manifest.yaml`. Idempotent: skips
|
|
6
|
+
* the file if it already exists.
|
|
7
|
+
*
|
|
8
|
+
* @see docs/architecture.md Section 2 "Kernel Space"
|
|
9
|
+
* @module generators/manifest
|
|
10
|
+
*/
|
|
11
|
+
import type { SetupAnswers, GeneratorResult } from '../types/index.js';
|
|
12
|
+
/**
|
|
13
|
+
* Generates `.agentos/manifest.yaml` inside the target vault directory.
|
|
14
|
+
*
|
|
15
|
+
* Behaviour:
|
|
16
|
+
* - Creates `.agentos/` directory if absent (recursive, safe).
|
|
17
|
+
* - Skips writing if `manifest.yaml` already exists (idempotent).
|
|
18
|
+
* - Serialises the manifest with `js-yaml` using 2-space indentation.
|
|
19
|
+
*
|
|
20
|
+
* @param answers - Setup answers from the interactive wizard.
|
|
21
|
+
* @returns A `GeneratorResult` listing created and skipped paths.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const result = await generateManifest(answers);
|
|
26
|
+
* console.log(result.created); // ['.agentos/manifest.yaml']
|
|
27
|
+
* console.log(result.skipped); // []
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function generateManifest(answers: SetupAnswers): Promise<GeneratorResult>;
|
|
31
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/generators/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAY,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAuEjF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAoCtF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest Generator — creates `.agentos/manifest.yaml`.
|
|
3
|
+
*
|
|
4
|
+
* Builds the kernel-space manifest from interactive setup answers and
|
|
5
|
+
* writes it to `{targetDir}/.agentos/manifest.yaml`. Idempotent: skips
|
|
6
|
+
* the file if it already exists.
|
|
7
|
+
*
|
|
8
|
+
* @see docs/architecture.md Section 2 "Kernel Space"
|
|
9
|
+
* @module generators/manifest
|
|
10
|
+
*/
|
|
11
|
+
import fs from 'node:fs/promises';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import yaml from 'js-yaml';
|
|
14
|
+
import { getDefaultPaths } from '../utils/fhs-mapping.js';
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Constants
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
/** Current manifest schema version. */
|
|
19
|
+
const AGENTOS_VERSION = '1.0.0';
|
|
20
|
+
/**
|
|
21
|
+
* Standard boot sequence — ordered list of init.d scripts loaded at startup.
|
|
22
|
+
* Mirrors a minimal SysVinit runlevel 3 boot (see architecture §4).
|
|
23
|
+
*/
|
|
24
|
+
const BOOT_SEQUENCE = [
|
|
25
|
+
'.agentos/init.d/00-identity.md',
|
|
26
|
+
'.agentos/init.d/10-memory.md',
|
|
27
|
+
'.agentos/init.d/20-today.md',
|
|
28
|
+
'.agentos/init.d/30-projects.md',
|
|
29
|
+
];
|
|
30
|
+
/** Frontmatter fields every vault file must declare. */
|
|
31
|
+
const FRONTMATTER_REQUIRED = ['date', 'tags'];
|
|
32
|
+
/** Recommended but optional frontmatter fields. */
|
|
33
|
+
const FRONTMATTER_STANDARD = ['status', 'stream', 'origin'];
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
// buildManifest
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
/**
|
|
38
|
+
* Constructs a typed `Manifest` object from setup answers.
|
|
39
|
+
*
|
|
40
|
+
* No I/O — pure transformation. The caller is responsible for serialising
|
|
41
|
+
* and persisting the result.
|
|
42
|
+
*
|
|
43
|
+
* @param answers - Wizard answers collected during `npx create-agentfs`.
|
|
44
|
+
* @returns A fully-populated `Manifest` ready for YAML serialisation.
|
|
45
|
+
*/
|
|
46
|
+
function buildManifest(answers) {
|
|
47
|
+
return {
|
|
48
|
+
agentos: {
|
|
49
|
+
version: AGENTOS_VERSION,
|
|
50
|
+
profile: answers.profile,
|
|
51
|
+
},
|
|
52
|
+
vault: {
|
|
53
|
+
name: answers.vaultName,
|
|
54
|
+
owner: answers.ownerName,
|
|
55
|
+
created: new Date().toISOString().slice(0, 10), // YYYY-MM-DD
|
|
56
|
+
},
|
|
57
|
+
agents: {
|
|
58
|
+
primary: answers.primaryAgent,
|
|
59
|
+
supported: answers.supportedAgents,
|
|
60
|
+
},
|
|
61
|
+
paths: getDefaultPaths(answers.profile),
|
|
62
|
+
boot: {
|
|
63
|
+
sequence: BOOT_SEQUENCE,
|
|
64
|
+
},
|
|
65
|
+
frontmatter: {
|
|
66
|
+
required: FRONTMATTER_REQUIRED,
|
|
67
|
+
standard: FRONTMATTER_STANDARD,
|
|
68
|
+
},
|
|
69
|
+
...(answers.modules.length > 0 ? { modules: answers.modules } : {}),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// generateManifest
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
/**
|
|
76
|
+
* Generates `.agentos/manifest.yaml` inside the target vault directory.
|
|
77
|
+
*
|
|
78
|
+
* Behaviour:
|
|
79
|
+
* - Creates `.agentos/` directory if absent (recursive, safe).
|
|
80
|
+
* - Skips writing if `manifest.yaml` already exists (idempotent).
|
|
81
|
+
* - Serialises the manifest with `js-yaml` using 2-space indentation.
|
|
82
|
+
*
|
|
83
|
+
* @param answers - Setup answers from the interactive wizard.
|
|
84
|
+
* @returns A `GeneratorResult` listing created and skipped paths.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const result = await generateManifest(answers);
|
|
89
|
+
* console.log(result.created); // ['.agentos/manifest.yaml']
|
|
90
|
+
* console.log(result.skipped); // []
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export async function generateManifest(answers) {
|
|
94
|
+
const result = { created: [], skipped: [] };
|
|
95
|
+
const agentosDir = path.join(answers.targetDir, '.agentos');
|
|
96
|
+
const manifestPath = path.join(agentosDir, 'manifest.yaml');
|
|
97
|
+
const manifestRelative = path.join('.agentos', 'manifest.yaml');
|
|
98
|
+
// Ensure .agentos/ directory exists before checking the manifest.
|
|
99
|
+
await fs.mkdir(agentosDir, { recursive: true });
|
|
100
|
+
// Idempotency check — never overwrite an existing manifest.
|
|
101
|
+
try {
|
|
102
|
+
await fs.access(manifestPath);
|
|
103
|
+
// File exists — skip.
|
|
104
|
+
result.skipped.push(manifestRelative);
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// File does not exist — proceed with creation.
|
|
109
|
+
}
|
|
110
|
+
const manifest = buildManifest(answers);
|
|
111
|
+
const yamlContent = '# AgentFS manifest — generated by create-agentfs. Do not edit manually.\n' +
|
|
112
|
+
'# See docs/architecture.md §2 for the full schema reference.\n\n' +
|
|
113
|
+
yaml.dump(manifest, {
|
|
114
|
+
indent: 2,
|
|
115
|
+
lineWidth: 100,
|
|
116
|
+
quotingType: "'",
|
|
117
|
+
forceQuotes: false,
|
|
118
|
+
});
|
|
119
|
+
await fs.writeFile(manifestPath, yamlContent, 'utf8');
|
|
120
|
+
result.created.push(manifestRelative);
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/generators/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,uCAAuC;AACvC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC;;;GAGG;AACH,MAAM,aAAa,GAAa;IAC9B,gCAAgC;IAChC,8BAA8B;IAC9B,6BAA6B;IAC7B,gCAAgC;CACjC,CAAC;AAEF,wDAAwD;AACxD,MAAM,oBAAoB,GAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAExD,mDAAmD;AACnD,MAAM,oBAAoB,GAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEtE,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,SAAS,aAAa,CAAC,OAAqB;IAC1C,OAAO;QACL,OAAO,EAAE;YACP,OAAO,EAAE,eAAe;YACxB,OAAO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,IAAI,EAAE,CAAC,CAAC;IAEhD,4DAA4D;IAC5D,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC9B,sBAAsB;QACtB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,+CAA+C;IACjD,CAAC;IAED,MAAM,QAAQ,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAExC,MAAM,WAAW,GACf,2EAA2E;QAC3E,kEAAkE;QAClE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,MAAM,EAAE,CAAC;YACT,SAAS,EAAE,GAAG;YACd,WAAW,EAAE,GAAG;YAChB,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC;IAEL,MAAM,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IACtD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAEtC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory Files Generator — creates `.agentos/memory/` seed files.
|
|
3
|
+
*
|
|
4
|
+
* Bootstraps the Tulving-taxonomy memory layer with two always-loaded files
|
|
5
|
+
* (`semantic.md`, `corrections.md`) and ensures the lazy-load directories
|
|
6
|
+
* (`episodic/`, `procedural/`) exist for future use.
|
|
7
|
+
*
|
|
8
|
+
* All writes are idempotent: existing files are skipped, never overwritten.
|
|
9
|
+
*
|
|
10
|
+
* @see docs/architecture.md Section 4 "Boot Sequence" — memory bootstrap
|
|
11
|
+
* @module generators/memory
|
|
12
|
+
*/
|
|
13
|
+
import type { SetupAnswers, GeneratorResult } from '../types/index.js';
|
|
14
|
+
/**
|
|
15
|
+
* Generates seed memory files and lazy-load directories in `.agentos/memory/`.
|
|
16
|
+
*
|
|
17
|
+
* Files produced:
|
|
18
|
+
* - `semantic.md` — typed facts/preferences, always loaded at boot
|
|
19
|
+
* - `corrections.md` — mistake log, always loaded at boot
|
|
20
|
+
*
|
|
21
|
+
* Directories ensured (created if absent, no-op if present):
|
|
22
|
+
* - `episodic/` — per-day event logs, lazy-loaded on demand
|
|
23
|
+
* - `procedural/` — skill documents, lazy-loaded on demand
|
|
24
|
+
*
|
|
25
|
+
* @param answers - Setup answers from the interactive wizard.
|
|
26
|
+
* @returns A `GeneratorResult` listing created and skipped paths.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const result = await generateMemoryFiles(answers);
|
|
31
|
+
* console.log(result.created);
|
|
32
|
+
* // ['.agentos/memory/semantic.md', '.agentos/memory/corrections.md']
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function generateMemoryFiles(answers: SetupAnswers): Promise<GeneratorResult>;
|
|
36
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/generators/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAiDvE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CA+BzF"}
|