faceted-prompting 0.1.0 → 0.2.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.
Files changed (88) hide show
  1. package/README.md +155 -16
  2. package/bin/facet +2 -0
  3. package/dist/cli/compose-context.d.ts +8 -0
  4. package/dist/cli/compose-context.d.ts.map +1 -0
  5. package/dist/cli/compose-context.js +194 -0
  6. package/dist/cli/compose-context.js.map +1 -0
  7. package/dist/cli/index.d.ts +3 -0
  8. package/dist/cli/index.d.ts.map +1 -0
  9. package/dist/cli/index.js +144 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/cli/install-skill/facets.d.ts +28 -0
  12. package/dist/cli/install-skill/facets.d.ts.map +1 -0
  13. package/dist/cli/install-skill/facets.js +160 -0
  14. package/dist/cli/install-skill/facets.js.map +1 -0
  15. package/dist/cli/install-skill/flow.d.ts +13 -0
  16. package/dist/cli/install-skill/flow.d.ts.map +1 -0
  17. package/dist/cli/install-skill/flow.js +63 -0
  18. package/dist/cli/install-skill/flow.js.map +1 -0
  19. package/dist/cli/install-skill/modes.d.ts +27 -0
  20. package/dist/cli/install-skill/modes.d.ts.map +1 -0
  21. package/dist/cli/install-skill/modes.js +130 -0
  22. package/dist/cli/install-skill/modes.js.map +1 -0
  23. package/dist/cli/install-skill/targets.d.ts +10 -0
  24. package/dist/cli/install-skill/targets.d.ts.map +1 -0
  25. package/dist/cli/install-skill/targets.js +27 -0
  26. package/dist/cli/install-skill/targets.js.map +1 -0
  27. package/dist/cli/path-guard.d.ts +12 -0
  28. package/dist/cli/path-guard.d.ts.map +1 -0
  29. package/dist/cli/path-guard.js +81 -0
  30. package/dist/cli/path-guard.js.map +1 -0
  31. package/dist/cli/runner.d.ts +10 -0
  32. package/dist/cli/runner.d.ts.map +1 -0
  33. package/dist/cli/runner.js +66 -0
  34. package/dist/cli/runner.js.map +1 -0
  35. package/dist/cli/select.d.ts +7 -0
  36. package/dist/cli/select.d.ts.map +1 -0
  37. package/dist/cli/select.js +70 -0
  38. package/dist/cli/select.js.map +1 -0
  39. package/dist/cli/skill-commands.d.ts +8 -0
  40. package/dist/cli/skill-commands.d.ts.map +1 -0
  41. package/dist/cli/skill-commands.js +44 -0
  42. package/dist/cli/skill-commands.js.map +1 -0
  43. package/dist/cli/skill-file-ops.d.ts +3 -0
  44. package/dist/cli/skill-file-ops.d.ts.map +1 -0
  45. package/dist/cli/skill-file-ops.js +89 -0
  46. package/dist/cli/skill-file-ops.js.map +1 -0
  47. package/dist/cli/skill-renderer.d.ts +24 -0
  48. package/dist/cli/skill-renderer.d.ts.map +1 -0
  49. package/dist/cli/skill-renderer.js +194 -0
  50. package/dist/cli/skill-renderer.js.map +1 -0
  51. package/dist/cli/skill-types.d.ts +31 -0
  52. package/dist/cli/skill-types.d.ts.map +1 -0
  53. package/dist/cli/skill-types.js +2 -0
  54. package/dist/cli/skill-types.js.map +1 -0
  55. package/dist/cli/types.d.ts +17 -0
  56. package/dist/cli/types.d.ts.map +1 -0
  57. package/dist/cli/types.js +2 -0
  58. package/dist/cli/types.js.map +1 -0
  59. package/dist/compose-definition.d.ts +3 -0
  60. package/dist/compose-definition.d.ts.map +1 -0
  61. package/dist/compose-definition.js +99 -0
  62. package/dist/compose-definition.js.map +1 -0
  63. package/dist/compose.d.ts.map +1 -1
  64. package/dist/compose.js +25 -19
  65. package/dist/compose.js.map +1 -1
  66. package/dist/config/index.d.ts +9 -0
  67. package/dist/config/index.d.ts.map +1 -0
  68. package/dist/config/index.js +82 -0
  69. package/dist/config/index.js.map +1 -0
  70. package/dist/index.d.ts +2 -1
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +1 -0
  73. package/dist/index.js.map +1 -1
  74. package/dist/init/index.d.ts +17 -0
  75. package/dist/init/index.d.ts.map +1 -0
  76. package/dist/init/index.js +205 -0
  77. package/dist/init/index.js.map +1 -0
  78. package/dist/output/index.d.ts +10 -0
  79. package/dist/output/index.d.ts.map +1 -0
  80. package/dist/output/index.js +67 -0
  81. package/dist/output/index.js.map +1 -0
  82. package/dist/prompt-payload.d.ts +8 -0
  83. package/dist/prompt-payload.d.ts.map +1 -0
  84. package/dist/prompt-payload.js +24 -0
  85. package/dist/prompt-payload.js.map +1 -0
  86. package/dist/types.d.ts +26 -0
  87. package/dist/types.d.ts.map +1 -1
  88. package/package.json +24 -7
@@ -0,0 +1,67 @@
1
+ import { closeSync, constants, mkdirSync, openSync, realpathSync, writeFileSync } from 'node:fs';
2
+ import { basename, dirname, resolve, sep } from 'node:path';
3
+ export function resolveOutputDirectory(inputValue, defaultDirectory) {
4
+ const trimmed = inputValue.trim();
5
+ if (trimmed.length === 0) {
6
+ return defaultDirectory;
7
+ }
8
+ return resolve(defaultDirectory, trimmed);
9
+ }
10
+ export function formatCombinedOutput(composed) {
11
+ const parts = [];
12
+ if (composed.systemPrompt.length > 0) {
13
+ parts.push(composed.systemPrompt);
14
+ }
15
+ if (composed.userMessage.length > 0) {
16
+ parts.push(composed.userMessage);
17
+ }
18
+ return parts.join('\n\n') + '\n';
19
+ }
20
+ export async function writeComposeOutput(options) {
21
+ const outputDir = resolve(options.outputDir);
22
+ mkdirSync(outputDir, { recursive: true });
23
+ const outputDirRealPath = realpathSync(outputDir);
24
+ if (basename(options.fileName) !== options.fileName) {
25
+ throw new Error(`Output file name must not include path segments: ${options.fileName}`);
26
+ }
27
+ const outputPath = resolve(outputDir, options.fileName);
28
+ if (!(outputPath === outputDir || outputPath.startsWith(`${outputDir}${sep}`))) {
29
+ throw new Error(`Output path escapes target directory: ${options.fileName}`);
30
+ }
31
+ const outputParentDirectory = dirname(outputPath);
32
+ mkdirSync(outputParentDirectory, { recursive: true });
33
+ const outputParentRealPath = realpathSync(outputParentDirectory);
34
+ if (!(outputParentRealPath === outputDirRealPath || outputParentRealPath.startsWith(`${outputDirRealPath}${sep}`))) {
35
+ throw new Error(`Output path escapes target directory: ${options.fileName}`);
36
+ }
37
+ const openFlags = constants.O_WRONLY
38
+ | constants.O_CREAT
39
+ | (options.overwrite ? constants.O_TRUNC : constants.O_EXCL)
40
+ | constants.O_NOFOLLOW;
41
+ let fileDescriptor;
42
+ try {
43
+ fileDescriptor = openSync(outputPath, openFlags, 0o600);
44
+ }
45
+ catch (error) {
46
+ const errorCode = error.code;
47
+ if (errorCode === 'ELOOP') {
48
+ throw new Error(`Symbolic links are not allowed for output file: ${outputPath}`);
49
+ }
50
+ if (errorCode === 'EEXIST' && !options.overwrite) {
51
+ throw new Error(`Output file exists and overwrite was cancelled: ${outputPath}`);
52
+ }
53
+ throw error;
54
+ }
55
+ try {
56
+ writeFileSync(fileDescriptor, options.content, 'utf-8');
57
+ }
58
+ finally {
59
+ closeSync(fileDescriptor);
60
+ }
61
+ const outputRealPath = realpathSync(outputPath);
62
+ if (!(outputRealPath === outputDirRealPath || outputRealPath.startsWith(`${outputDirRealPath}${sep}`))) {
63
+ throw new Error(`Output path escapes target directory: ${options.fileName}`);
64
+ }
65
+ return outputPath;
66
+ }
67
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/output/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAG5D,MAAM,UAAU,sBAAsB,CAAC,UAAkB,EAAE,gBAAwB;IACjF,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IAClC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,OAAO,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,QAAwB;IAC3D,MAA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CAAC,cAAc,KAAK,iBAAiB,IAAI,cAAc,CAAC,UAAU,CAAC,GAAG,iBAAiB,GAAG,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;QACvG,MAAM,IAAI,KAAK,CAAC,yCAAyC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ComposeDefinition, ComposedPromptPayload, ComposeOptions } from './types.js';
2
+ export declare function composePromptPayload(params: {
3
+ definition: ComposeDefinition;
4
+ definitionDir: string;
5
+ facetsRoot: string;
6
+ composeOptions: ComposeOptions;
7
+ }): ComposedPromptPayload;
8
+ //# sourceMappingURL=prompt-payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-payload.d.ts","sourceRoot":"","sources":["../src/prompt-payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,cAAc,EAAa,MAAM,YAAY,CAAC;AAmBtG,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,UAAU,EAAE,iBAAiB,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;CAChC,GAAG,qBAAqB,CAYxB"}
@@ -0,0 +1,24 @@
1
+ import { compose } from './compose.js';
2
+ import { buildFacetSet, resolveDefinitionSections } from './cli/skill-renderer.js';
3
+ function buildCopyFiles(params) {
4
+ const resolved = resolveDefinitionSections(params);
5
+ return {
6
+ persona: [resolved.persona.path],
7
+ knowledge: resolved.knowledge.map(section => section.path),
8
+ policies: resolved.policies.map(section => section.path),
9
+ instructions: resolved.instruction && 'path' in resolved.instruction ? [resolved.instruction.path] : [],
10
+ };
11
+ }
12
+ export function composePromptPayload(params) {
13
+ const facetSet = buildFacetSet(params);
14
+ const composed = compose(facetSet, {
15
+ ...params.composeOptions,
16
+ userMessageOrder: params.definition.order,
17
+ });
18
+ return {
19
+ systemPrompt: composed.systemPrompt,
20
+ userPrompt: composed.userMessage,
21
+ copyFiles: buildCopyFiles(params),
22
+ };
23
+ }
24
+ //# sourceMappingURL=prompt-payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-payload.js","sourceRoot":"","sources":["../src/prompt-payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEnF,SAAS,cAAc,CAAC,MAIvB;IACC,MAAM,QAAQ,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAEnD,OAAO;QACL,OAAO,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;QAChC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;QAC1D,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;QACxD,YAAY,EACV,QAAQ,CAAC,WAAW,IAAI,MAAM,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;KAC5F,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAKpC;IACC,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE;QACjC,GAAG,MAAM,CAAC,cAAc;QACxB,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK;KAC1C,CAAC,CAAC;IAEH,OAAO;QACL,YAAY,EAAE,QAAQ,CAAC,YAAY;QACnC,UAAU,EAAE,QAAQ,CAAC,WAAW;QAChC,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC;KAClC,CAAC;AACJ,CAAC"}
package/dist/types.d.ts CHANGED
@@ -36,9 +36,35 @@ export interface ComposedPrompt {
36
36
  readonly systemPrompt: string;
37
37
  readonly userMessage: string;
38
38
  }
39
+ export interface CopyFiles {
40
+ readonly persona: readonly string[];
41
+ readonly knowledge: readonly string[];
42
+ readonly policies: readonly string[];
43
+ readonly instructions: readonly string[];
44
+ }
45
+ export interface ComposedPromptPayload {
46
+ readonly systemPrompt: string;
47
+ readonly userPrompt: string;
48
+ readonly copyFiles: CopyFiles;
49
+ }
50
+ /** User-message sections that can be ordered in compose definitions. */
51
+ export type ComposeOrderEntry = 'policies' | 'knowledge' | 'instruction';
52
+ /** CLI compose definition loaded from YAML. */
53
+ export interface ComposeDefinition {
54
+ readonly name: string;
55
+ readonly description?: string;
56
+ readonly persona: string;
57
+ readonly template?: string;
58
+ readonly knowledge?: readonly string[];
59
+ readonly policies?: readonly string[];
60
+ readonly instruction?: string;
61
+ readonly order?: readonly ComposeOrderEntry[];
62
+ }
39
63
  /** Options controlling compose() behaviour. */
40
64
  export interface ComposeOptions {
41
65
  /** Maximum character length for knowledge/policy content before truncation. */
42
66
  readonly contextMaxChars: number;
67
+ /** Optional user-message section order for policies/knowledge/instruction. */
68
+ readonly userMessageOrder?: readonly ComposeOrderEntry[];
43
69
  }
44
70
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,uDAAuD;AACvD,MAAM,MAAM,SAAS,GACjB,UAAU,GACV,UAAU,GACV,WAAW,GACX,cAAc,GACd,kBAAkB,CAAC;AAEvB,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,UAAU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AC1D"}
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "faceted-prompting",
3
- "version": "0.1.0",
4
- "description": "Faceted Prompting \u2014 structured prompt composition for LLMs",
3
+ "version": "0.2.1",
4
+ "description": "Faceted Prompting structured prompt composition for LLMs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "facet": "./bin/facet"
10
+ },
8
11
  "exports": {
9
12
  ".": {
10
13
  "types": "./dist/index.d.ts",
@@ -12,15 +15,24 @@
12
15
  }
13
16
  },
14
17
  "files": [
15
- "dist"
18
+ "dist",
19
+ "bin/facet"
16
20
  ],
17
21
  "scripts": {
18
22
  "build": "tsc",
19
23
  "watch": "tsc --watch",
20
- "test": "vitest run",
24
+ "test": "npm run test:unit",
25
+ "test:unit": "vitest run --config vitest.config.ts",
21
26
  "test:watch": "vitest",
27
+ "test:e2e": "tmp=\"$(mktemp -t faceted-prompting-e2e.XXXXXX)\"; mkdir -p e2e/results; npm run test:e2e:cli >\"$tmp\" 2>&1; code=$?; cat \"$tmp\"; rm -f \"$tmp\"; if [ \"$code\" -eq 0 ]; then msg='test:e2e passed'; else msg=\"test:e2e failed (exit=$code)\"; fi; if command -v osascript >/dev/null 2>&1; then osascript -e \"display notification \\\"$msg\\\" with title \\\"faceted-prompting\\\" subtitle \\\"E2E\\\"\" >/dev/null 2>&1 || true; fi; echo \"[faceted-prompting] $msg\"; exit $code",
28
+ "test:e2e:cli": "vitest run --config vitest.config.e2e.ts --outputFile.json=e2e/results/cli.json",
22
29
  "lint": "eslint src/",
23
- "prepublishOnly": "npm run build && npm run test"
30
+ "pack:check": "npm_config_cache=/tmp/.npm-faceted npm pack --dry-run",
31
+ "smoke:pack": "tmp=\"$(mktemp -d -t faceted-prompting-pack.XXXXXX)\"; npm_config_cache=/tmp/.npm-faceted npm pack --pack-destination \"$tmp\" >/dev/null; tarball=\"$(find \"$tmp\" -maxdepth 1 -name '*.tgz' -print -quit)\"; npm_config_cache=/tmp/.npm-faceted npm install --no-audit --fund=false --ignore-scripts --prefix \"$tmp/install\" \"$tarball\" >/dev/null; cd \"$tmp/install\" && node --input-type=module -e \"const pkg = await import('faceted-prompting'); if (typeof pkg.compose !== 'function') throw new Error('compose export missing');\" && test -x ./node_modules/.bin/facet; rm -rf \"$tmp\"",
32
+ "verify:release": "npm run build && npm run lint && npm run test:unit && npm run test:e2e && npm run pack:check && npm run smoke:pack",
33
+ "check:release": "npm run build && npm run lint && npm run test:unit && npm run test:e2e; code=$?; if [ \"$code\" -eq 0 ]; then msg='check:release passed'; else msg=\"check:release failed (exit=$code)\"; fi; if command -v osascript >/dev/null 2>&1; then osascript -e \"display notification \\\"$msg\\\" with title \\\"faceted-prompting\\\" subtitle \\\"Release Check\\\"\" >/dev/null 2>&1 || true; fi; echo \"[faceted-prompting] $msg\"; exit $code",
34
+ "prepack": "npm run build",
35
+ "prepublishOnly": "npm run verify:release"
24
36
  },
25
37
  "keywords": [
26
38
  "prompt",
@@ -31,12 +43,17 @@
31
43
  ],
32
44
  "license": "MIT",
33
45
  "engines": {
34
- "node": ">=18"
46
+ "node": ">=20"
35
47
  },
36
48
  "devDependencies": {
37
49
  "@types/node": "^22.19.11",
38
50
  "eslint": "^9.0.0",
39
51
  "typescript": "^5.9.3",
52
+ "typescript-eslint": "^8.57.0",
40
53
  "vitest": "^3.2.4"
54
+ },
55
+ "dependencies": {
56
+ "traced-config": "^0.1.0",
57
+ "yaml": "^2.8.1"
41
58
  }
42
- }
59
+ }